diff --git a/DEPS b/DEPS
index 82cf1f4f..33e0d3a 100644
--- a/DEPS
+++ b/DEPS
@@ -318,7 +318,7 @@
   },
 
   'src/third_party/depot_tools':
-    Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + '17995a9f128290b66e16f2fdfba96b4369425f8c',
+    Var('chromium_git') + '/chromium/tools/depot_tools.git' + '@' + 'ad64abd69aedabe7da5db9ca6de6fd28fca879d2',
 
   # DevTools node modules. Used on Linux buildbots only.
   'src/third_party/devtools-node-modules': {
@@ -634,7 +634,7 @@
     Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '05591bbeae6592fd924caec8e728a4ea86cbb8c9',
 
   'src/third_party/webrtc':
-    Var('webrtc_git') + '/src.git' + '@' + 'a9f469b2184dfdb723fc23e90076c37916f08157', # commit position 20628
+    Var('webrtc_git') + '/src.git' + '@' + '86de7e898a636c61fc6d86fdaf8f538f6662ed55', # commit position 20628
 
   'src/third_party/xdg-utils': {
       'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc
index fed0433..046f03e4 100644
--- a/base/bind_unittest.cc
+++ b/base/bind_unittest.cc
@@ -1281,11 +1281,11 @@
 }
 
 TEST_F(BindTest, CapturingLambdaForTesting) {
-  int x = 42;
-  EXPECT_EQ(42, BindLambdaForTesting([=] { return x; }).Run());
+  int x = 6;
+  EXPECT_EQ(42, BindLambdaForTesting([=](int y) { return x * y; }).Run(7));
 
-  auto f = [x] { return x; };
-  EXPECT_EQ(42, BindLambdaForTesting(f).Run());
+  auto f = [x](std::unique_ptr<int> y) { return x * *y; };
+  EXPECT_EQ(42, BindLambdaForTesting(f).Run(std::make_unique<int>(7)));
 }
 
 TEST_F(BindTest, Cancellation) {
diff --git a/base/test/bind_test_util.h b/base/test/bind_test_util.h
index c6d52fb3..00824b2e 100644
--- a/base/test/bind_test_util.h
+++ b/base/test/bind_test_util.h
@@ -8,13 +8,27 @@
 #include "base/bind.h"
 
 namespace base {
+namespace internal {
+
+template <typename F, typename Signature>
+struct BindLambdaHelper;
+
+template <typename F, typename R, typename... Args>
+struct BindLambdaHelper<F, R(Args...)> {
+  static R Run(const std::decay_t<F>& f, Args... args) {
+    return f(std::forward<Args>(args)...);
+  }
+};
+
+}  // namespace internal
 
 // A variant of Bind() that can bind capturing lambdas for testing.
 // This doesn't support extra arguments binding as the lambda itself can do.
 template <typename F>
 RepeatingCallback<internal::ExtractCallableRunType<std::decay_t<F>>>
 BindLambdaForTesting(F&& f) {
-  return BindRepeating([](const std::decay_t<F>& f) { return f(); },
+  using Signature = internal::ExtractCallableRunType<std::decay_t<F>>;
+  return BindRepeating(&internal::BindLambdaHelper<F, Signature>::Run,
                        std::forward<F>(f));
 }
 
diff --git a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc
index 94a7842..d818087 100644
--- a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc
+++ b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.cc
@@ -13,23 +13,16 @@
 #include "chrome/browser/previews/previews_infobar_delegate.h"
 #include "chrome/common/page_load_metrics/page_load_timing.h"
 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h"
+#include "components/previews/content/previews_content_util.h"
 #include "components/ukm/ukm_source.h"
 #include "content/public/browser/navigation_handle.h"
+#include "content/public/common/previews_state.h"
+#include "services/metrics/public/cpp/ukm_builders.h"
 #include "services/metrics/public/cpp/ukm_entry_builder.h"
 #include "services/metrics/public/cpp/ukm_recorder.h"
 
 namespace previews {
 
-namespace {
-
-const char kPreviewsName[] = "Previews";
-const char kPreviewsServerLoFi[] = "server_lofi";
-const char kPreviewsClientLoFi[] = "client_lofi";
-const char kPreviewsLitePage[] = "lite_page";
-const char kPreviewsOptOut[] = "opt_out";
-
-}  // namespace
-
 PreviewsUKMObserver::PreviewsUKMObserver() {}
 
 PreviewsUKMObserver::~PreviewsUKMObserver() {}
@@ -53,6 +46,12 @@
   if (data && data->used_data_reduction_proxy() && data->lite_page_received()) {
     lite_page_seen_ = true;
   }
+  content::PreviewsState previews_state =
+      chrome_navigation_data->previews_state();
+  if (previews_state && previews::GetMainFramePreviewsType(previews_state) ==
+                            previews::PreviewsType::NOSCRIPT) {
+    noscript_seen_ = true;
+  }
 
   return CONTINUE_OBSERVING;
 }
@@ -86,21 +85,21 @@
 void PreviewsUKMObserver::RecordPreviewsTypes(
     const page_load_metrics::PageLoadExtraInfo& info) {
   // Only record previews types when they occur.
-  if (!server_lofi_seen_ && !client_lofi_seen_ && !lite_page_seen_)
+  if (!server_lofi_seen_ && !client_lofi_seen_ && !lite_page_seen_ &&
+      !noscript_seen_)
     return;
-  ukm::UkmRecorder* ukm_recorder = ukm::UkmRecorder::Get();
-  if (!ukm_recorder)
-    return;
-  std::unique_ptr<ukm::UkmEntryBuilder> builder =
-      ukm_recorder->GetEntryBuilder(info.source_id, kPreviewsName);
+  ukm::builders::Previews builder(info.source_id);
   if (server_lofi_seen_)
-    builder->AddMetric(kPreviewsServerLoFi, true);
+    builder.Setserver_lofi(1);
   if (client_lofi_seen_)
-    builder->AddMetric(kPreviewsClientLoFi, true);
+    builder.Setclient_lofi(1);
   if (lite_page_seen_)
-    builder->AddMetric(kPreviewsLitePage, true);
+    builder.Setlite_page(1);
+  if (noscript_seen_)
+    builder.Setnoscript(1);
   if (opt_out_occurred_)
-    builder->AddMetric(kPreviewsOptOut, true);
+    builder.Setopt_out(1);
+  builder.Record(ukm::UkmRecorder::Get());
 }
 
 void PreviewsUKMObserver::OnLoadedResource(
diff --git a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h
index c39d1c1..394f62d2d 100644
--- a/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h
+++ b/chrome/browser/page_load_metrics/observers/previews_ukm_observer.h
@@ -43,6 +43,7 @@
   bool server_lofi_seen_ = false;
   bool client_lofi_seen_ = false;
   bool lite_page_seen_ = false;
+  bool noscript_seen_ = false;
   bool opt_out_occurred_ = false;
 
   SEQUENCE_CHECKER(sequence_checker_);
diff --git a/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc b/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
index b664ac3..86fc1c5 100644
--- a/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
+++ b/chrome/browser/page_load_metrics/observers/previews_ukm_observer_unittest.cc
@@ -17,6 +17,7 @@
 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_data.h"
 #include "components/ukm/test_ukm_recorder.h"
 #include "components/ukm/ukm_source.h"
+#include "content/public/common/previews_state.h"
 #include "content/public/test/web_contents_tester.h"
 #include "services/metrics/public/cpp/ukm_builders.h"
 
@@ -44,10 +45,12 @@
  public:
   TestPreviewsUKMObserver(content::WebContents* web_contents,
                           bool data_reduction_proxy_used,
-                          bool lite_page_received)
+                          bool lite_page_received,
+                          bool noscript_on)
       : web_contents_(web_contents),
         data_reduction_proxy_used_(data_reduction_proxy_used),
-        lite_page_received_(lite_page_received) {}
+        lite_page_received_(lite_page_received),
+        noscript_on_(noscript_on) {}
 
   ~TestPreviewsUKMObserver() override {}
 
@@ -59,6 +62,19 @@
     data->set_used_data_reduction_proxy(data_reduction_proxy_used_);
     data->set_request_url(GURL(kDefaultTestUrl));
     data->set_lite_page_received(lite_page_received_);
+
+    if (noscript_on_) {
+      // ChromeNavigationData is guaranteed to be non-null at this point, as
+      // DataForNavigationHandle is always called prior to this and creates one.
+      ChromeNavigationData* chrome_navigation_data =
+          static_cast<ChromeNavigationData*>(
+              navigation_handle->GetNavigationData());
+      content::PreviewsState previews_state =
+          chrome_navigation_data->previews_state();
+      chrome_navigation_data->set_previews_state(previews_state |=
+                                                 content::NOSCRIPT_ON);
+    }
+
     return PreviewsUKMObserver::OnCommit(navigation_handle, source_id);
   }
 
@@ -66,6 +82,7 @@
   content::WebContents* web_contents_;
   bool data_reduction_proxy_used_;
   bool lite_page_received_;
+  bool noscript_on_;
 
   DISALLOW_COPY_AND_ASSIGN(TestPreviewsUKMObserver);
 };
@@ -76,20 +93,24 @@
   PreviewsUKMObserverTest() {}
   ~PreviewsUKMObserverTest() override {}
 
-  void RunTest(bool data_reduction_proxy_used, bool lite_page_received) {
+  void RunTest(bool data_reduction_proxy_used,
+               bool lite_page_received,
+               bool noscript_on) {
     data_reduction_proxy_used_ = data_reduction_proxy_used;
     lite_page_received_ = lite_page_received;
+    noscript_on_ = noscript_on;
     NavigateAndCommit(GURL(kDefaultTestUrl));
   }
 
   void ValidateUKM(bool server_lofi_expected,
                    bool client_lofi_expected,
                    bool lite_page_expected,
+                   bool noscript_expected,
                    bool opt_out_expected) {
     using UkmEntry = ukm::builders::Previews;
     auto entries = test_ukm_recorder().GetEntriesByName(UkmEntry::kEntryName);
     if (!server_lofi_expected && !client_lofi_expected && !lite_page_expected &&
-        !opt_out_expected) {
+        !noscript_expected && !opt_out_expected) {
       EXPECT_EQ(0u, entries.size());
       return;
     }
@@ -102,6 +123,8 @@
                                           entry, UkmEntry::kclient_lofiName));
       EXPECT_EQ(lite_page_expected, test_ukm_recorder().EntryHasMetric(
                                         entry, UkmEntry::klite_pageName));
+      EXPECT_EQ(noscript_expected, test_ukm_recorder().EntryHasMetric(
+                                       entry, UkmEntry::knoscriptName));
       EXPECT_EQ(opt_out_expected, test_ukm_recorder().EntryHasMetric(
                                       entry, UkmEntry::kopt_outName));
     }
@@ -110,32 +133,35 @@
  protected:
   void RegisterObservers(page_load_metrics::PageLoadTracker* tracker) override {
     tracker->AddObserver(base::MakeUnique<TestPreviewsUKMObserver>(
-        web_contents(), data_reduction_proxy_used_, lite_page_received_));
+        web_contents(), data_reduction_proxy_used_, lite_page_received_,
+        noscript_on_));
     // Data is only added to the first navigation after RunTest().
     data_reduction_proxy_used_ = false;
     lite_page_received_ = false;
+    noscript_on_ = false;
   }
 
  private:
   bool data_reduction_proxy_used_ = false;
   bool lite_page_received_ = false;
+  bool noscript_on_ = false;
 
   DISALLOW_COPY_AND_ASSIGN(PreviewsUKMObserverTest);
 };
 
 TEST_F(PreviewsUKMObserverTest, NoPreviewSeen) {
-  RunTest(false /* data_reduction_proxy_used */,
-          false /* lite_page_received */);
+  RunTest(false /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
   NavigateToUntrackedUrl();
 
   ValidateUKM(false /* server_lofi_expected */,
               false /* client_lofi_expected */, false /* lite_page_expected */,
-              false /* opt_out_expected */);
+              false /* noscript_expected */, false /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, UntrackedPreviewTypeOptOut) {
-  RunTest(false /* data_reduction_proxy_used */,
-          false /* lite_page_received */);
+  RunTest(false /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
   observer()->BroadcastEventToObservers(
       PreviewsInfoBarDelegate::OptOutEventKey());
   NavigateToUntrackedUrl();
@@ -143,21 +169,23 @@
   // Opt out should not be added sicne we don't track this type.
   ValidateUKM(false /* server_lofi_expected */,
               false /* client_lofi_expected */, false /* lite_page_expected */,
-              false /* opt_out_expected */);
+              false /* noscript_expected */, false /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, LitePageSeen) {
-  RunTest(true /* data_reduction_proxy_used */, true /* lite_page_received */);
+  RunTest(true /* data_reduction_proxy_used */, true /* lite_page_received */,
+          false /* noscript_on */);
 
   NavigateToUntrackedUrl();
 
   ValidateUKM(false /* server_lofi_expected */,
               false /* client_lofi_expected */, true /* lite_page_expected */,
-              false /* opt_out_expected */);
+              false /* noscript_expected */, false /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, LitePageOptOut) {
-  RunTest(true /* data_reduction_proxy_used */, true /* lite_page_received */);
+  RunTest(true /* data_reduction_proxy_used */, true /* lite_page_received */,
+          false /* noscript_on */);
 
   observer()->BroadcastEventToObservers(
       PreviewsInfoBarDelegate::OptOutEventKey());
@@ -165,12 +193,36 @@
 
   ValidateUKM(false /* server_lofi_expected */,
               false /* client_lofi_expected */, true /* lite_page_expected */,
-              true /* opt_out_expected */);
+              false /* noscript_expected */, true /* opt_out_expected */);
+}
+
+TEST_F(PreviewsUKMObserverTest, NoScriptSeen) {
+  RunTest(false /* data_reduction_proxy_used */, false /* lite_page_received */,
+          true /* noscript_on */);
+
+  NavigateToUntrackedUrl();
+
+  ValidateUKM(false /* server_lofi_expected */,
+              false /* client_lofi_expected */, false /* lite_page_expected */,
+              true /* noscript_expected */, false /* opt_out_expected */);
+}
+
+TEST_F(PreviewsUKMObserverTest, NoScriptOptOut) {
+  RunTest(false /* data_reduction_proxy_used */, false /* lite_page_received */,
+          true /* noscript_on */);
+
+  observer()->BroadcastEventToObservers(
+      PreviewsInfoBarDelegate::OptOutEventKey());
+  NavigateToUntrackedUrl();
+
+  ValidateUKM(false /* server_lofi_expected */,
+              false /* client_lofi_expected */, false /* lite_page_expected */,
+              true /* noscript_expected */, true /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, ClientLoFiSeen) {
-  RunTest(false /* data_reduction_proxy_used */,
-          false /* lite_page_received */);
+  RunTest(false /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
       base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
@@ -199,12 +251,13 @@
   NavigateToUntrackedUrl();
 
   ValidateUKM(false /* server_lofi_expected */, true /* client_lofi_expected */,
-              false /* lite_page_expected */, false /* opt_out_expected */);
+              false /* lite_page_expected */, false /* noscript_expected */,
+              false /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, ClientLoFiOptOut) {
-  RunTest(false /* data_reduction_proxy_used */,
-          false /* lite_page_received */);
+  RunTest(false /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
       base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
@@ -234,11 +287,13 @@
   NavigateToUntrackedUrl();
 
   ValidateUKM(false /* server_lofi_expected */, true /* client_lofi_expected */,
-              false /* lite_page_expected */, true /* opt_out_expected */);
+              false /* lite_page_expected */, false /* noscript_expected */,
+              true /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, ServerLoFiSeen) {
-  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */);
+  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
       base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
@@ -267,11 +322,13 @@
   NavigateToUntrackedUrl();
 
   ValidateUKM(true /* server_lofi_expected */, false /* client_lofi_expected */,
-              false /* lite_page_expected */, false /* opt_out_expected */);
+              false /* lite_page_expected */, false /* noscript_expected */,
+              false /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, ServerLoFiOptOut) {
-  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */);
+  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data =
       base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
@@ -302,11 +359,13 @@
   NavigateToUntrackedUrl();
 
   ValidateUKM(true /* server_lofi_expected */, false /* client_lofi_expected */,
-              false /* lite_page_expected */, true /* opt_out_expected */);
+              false /* lite_page_expected */, false /* noscript_expected */,
+              true /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, BothLoFiSeen) {
-  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */);
+  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data1 =
       base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
@@ -340,11 +399,13 @@
 
   NavigateToUntrackedUrl();
   ValidateUKM(true /* server_lofi_expected */, true /* client_lofi_expected */,
-              false /* lite_page_expected */, false /* opt_out_expected */);
+              false /* lite_page_expected */, false /* noscript_expected */,
+              false /* opt_out_expected */);
 }
 
 TEST_F(PreviewsUKMObserverTest, BothLoFiOptOut) {
-  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */);
+  RunTest(true /* data_reduction_proxy_used */, false /* lite_page_received */,
+          false /* noscript_on */);
 
   std::unique_ptr<data_reduction_proxy::DataReductionProxyData> data1 =
       base::MakeUnique<data_reduction_proxy::DataReductionProxyData>();
@@ -379,7 +440,8 @@
       PreviewsInfoBarDelegate::OptOutEventKey());
   NavigateToUntrackedUrl();
   ValidateUKM(true /* server_lofi_expected */, true /* client_lofi_expected */,
-              false /* lite_page_expected */, true /* opt_out_expected */);
+              false /* lite_page_expected */, false /* noscript_expected */,
+              true /* opt_out_expected */);
 }
 
 }  // namespace
diff --git a/chrome/browser/resources/settings/device_page/display.html b/chrome/browser/resources/settings/device_page/display.html
index 46cb7649..b3e57b25 100644
--- a/chrome/browser/resources/settings/device_page/display.html
+++ b/chrome/browser/resources/settings/device_page/display.html
@@ -147,7 +147,7 @@
             [[getResolutionText_(selectedDisplay, selectedModePref_.value)]]
           </div>
         </div>
-        <settings-slider disabled="[[selectedDisplay.isTabletMode]]"
+        <settings-slider disabled="[[!enableSetResolution_(selectedDisplay)]]"
             tick-values="[[modeValues_]]" pref="{{selectedModePref_}}"
             on-change="onSelectedModeChange_">
         </settings-slider>
diff --git a/chrome/renderer/autofill/form_autocomplete_browsertest.cc b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
index 225fd7f2..b77136e 100644
--- a/chrome/renderer/autofill/form_autocomplete_browsertest.cc
+++ b/chrome/renderer/autofill/form_autocomplete_browsertest.cc
@@ -197,6 +197,14 @@
     fake_driver_.BindRequest(mojom::AutofillDriverRequest(std::move(handle)));
   }
 
+  void SimulateUserInput(const blink::WebString& id, const std::string& value) {
+    WebDocument document = GetMainFrame()->GetDocument();
+    WebElement element = document.GetElementById(id);
+    ASSERT_FALSE(element.IsNull());
+    WebInputElement fname_element = element.To<WebInputElement>();
+    SimulateUserInputChangeForElement(&fname_element, value);
+  }
+
   FakeContentAutofillDriver fake_driver_;
 
  private:
@@ -220,9 +228,10 @@
                                  true /* expect_submitted_message */);
 }
 
+// TODO(crbug.com/785504): Rewrite this test.
 // Tests that submitting a form that prevents the submit event from propagating
 // will only send the WillSubmitForm message.
-TEST_F(FormAutocompleteTest, SubmitEventPrevented) {
+TEST_F(FormAutocompleteTest, DISABLED_SubmitEventPrevented) {
   // Load a form.
   LoadHTML(
       "<html><form id='myForm'><input name='fname' value='Rick'/>"
@@ -432,6 +441,10 @@
   // Simulate filling a form using Autofill.
   SimulateOnFillForm(autofill_agent_, GetMainFrame());
 
+  // Simulate user input since ajax request doesn't fire submission message
+  // if there is no user input.
+  SimulateUserInput(WebString::FromUTF8("fname"), std::string("Rick"));
+
   // Simulate removing the form just before the ajax request completes.
   ExecuteJavaScriptForTests("var element = document.getElementById('myForm');"
                             "element.parentNode.removeChild(element);");
@@ -440,7 +453,7 @@
   static_cast<blink::WebAutofillClient*>(autofill_agent_)->AjaxSucceeded();
   base::RunLoop().RunUntilIdle();
 
-  VerifyReceivedRendererMessages(fake_driver_, "John", "Smith",
+  VerifyReceivedRendererMessages(fake_driver_, "Rick", "Smith",
                                  true /* expect_submitted_message */);
 }
 
diff --git a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
index cbd00380..3ce7710 100644
--- a/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
+++ b/chrome/renderer/autofill/password_autofill_agent_browsertest.cc
@@ -16,6 +16,7 @@
 #include "chrome/test/base/chrome_render_view_test.h"
 #include "components/autofill/content/renderer/autofill_agent.h"
 #include "components/autofill/content/renderer/form_autofill_util.h"
+#include "components/autofill/content/renderer/form_tracker.h"
 #include "components/autofill/content/renderer/test_password_autofill_agent.h"
 #include "components/autofill/content/renderer/test_password_generation_agent.h"
 #include "components/autofill/core/common/autofill_constants.h"
@@ -42,6 +43,7 @@
 #include "third_party/WebKit/public/web/WebView.h"
 #include "ui/events/keycodes/keyboard_codes.h"
 
+using autofill::FormTracker;
 using autofill::PasswordForm;
 using base::ASCIIToUTF16;
 using base::UTF16ToUTF8;
@@ -648,6 +650,33 @@
         mojom::PasswordManagerClientAssociatedRequest(std::move(handle)));
   }
 
+  void SaveAndSubmitForm() { SaveAndSubmitForm(username_element_.Form()); }
+
+  void SaveAndSubmitForm(const WebFormElement& form_element) {
+    FormTracker* tracker = autofill_agent_->form_tracker_for_testing();
+    static_cast<content::RenderFrameObserver*>(tracker)->WillSendSubmitEvent(
+        form_element);
+    static_cast<content::RenderFrameObserver*>(tracker)->WillSubmitForm(
+        form_element);
+  }
+
+  void SubmitForm() {
+    FormTracker* tracker = autofill_agent_->form_tracker_for_testing();
+    static_cast<content::RenderFrameObserver*>(tracker)->WillSubmitForm(
+        username_element_.Form());
+  }
+
+  void FireAjaxSucceeded() {
+    FormTracker* tracker = autofill_agent_->form_tracker_for_testing();
+    tracker->AjaxSucceeded();
+  }
+
+  void FireDidCommitProvisionalLoad() {
+    FormTracker* tracker = autofill_agent_->form_tracker_for_testing();
+    static_cast<content::RenderFrameObserver*>(tracker)
+        ->DidCommitProvisionalLoad(false, true);
+  }
+
   FakeContentPasswordManagerDriver fake_driver_;
   FakePasswordManagerClient fake_pw_client_;
 
@@ -1712,8 +1741,8 @@
   // site's JavaScript before submit.
   username_element_.SetValue(WebString());
   password_element_.SetValue(WebString());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SubmitForm();
 
   // Observe that the PasswordAutofillAgent still remembered the last non-empty
   // username and password and sent that to the browser.
@@ -1732,8 +1761,8 @@
   // Simulate that the user actually cleared the username and password again.
   SimulateUsernameTyping("");
   SimulatePasswordTyping("");
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SubmitForm();
 
   // Observe that the PasswordAutofillAgent respects the user having cleared the
   // password.
@@ -1760,8 +1789,8 @@
   // the site's JavaScript before submit.
   username_element_.SetValue(WebString());
   password_element_.SetValue(WebString());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SubmitForm();
 
   // Observe that the PasswordAutofillAgent still remembered the last non-empty
   // password and sent that to the browser.
@@ -1823,10 +1852,8 @@
   // site's JavaScript before submit.
   username_element_.SetValue(WebString("new username"));
   password_element_.SetValue(WebString("new password"));
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent still remembered the last typed
   // username and password and sent that to the browser.
@@ -1841,10 +1868,8 @@
   // site's JavaScript before submit.
   username_element_.SetValue(WebString("new username"));
   password_element_.SetValue(WebString("new password"));
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SaveAndSubmitForm();
 
   std::map<base::string16, FieldPropertiesMask> expected_properties_masks;
   expected_properties_masks[ASCIIToUTF16("random_field")] =
@@ -1871,7 +1896,7 @@
       "username.style = 'display:none';";
   ExecuteJavaScriptForTests(hide_elements.c_str());
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   std::map<base::string16, FieldPropertiesMask> expected_properties_masks;
   expected_properties_masks[ASCIIToUTF16("username")] =
@@ -1890,7 +1915,7 @@
   SimulateUsernameTyping("Bob");
   SimulatePasswordTyping("mypassword");
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   std::string hide_elements =
       "var password = document.getElementById('password');"
@@ -1922,10 +1947,8 @@
   // site's JavaScript before submit.
   username_element_.SetValue(WebString("new username"));
   password_element_.SetValue(WebString("new password"));
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent still remembered the autofilled
   // username and password and sent that to the browser.
@@ -1949,10 +1972,8 @@
   // site's JavaScript before submit.
   username_element_.SetValue(WebString("new username"));
   password_element_.SetValue(WebString("new password"));
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent still remembered the last typed
   // username and password and sent that to the browser.
@@ -1968,10 +1989,7 @@
   username_element_.SetValue(WebString("temp"));
   SimulatePasswordTyping("random");
 
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent still remembered the last typed
   // username and password and sent that to the browser.
@@ -1994,10 +2012,7 @@
   // Simulate that the user selected username that was generated by script.
   username_element_.SetValue(WebString("foo.smith"));
 
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent still remembered the last typed
   // username and password and sent that to the browser.
@@ -2179,10 +2194,8 @@
   SimulateUsernameTyping("temp");
   SimulateUserInputChangeForElement(&email_element, "temp@google.com");
   SimulatePasswordTyping("random");
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent identifies the second field (e-mail)
   // as username.
@@ -2222,10 +2235,7 @@
       "form.appendChild(new_input);";
   ExecuteJavaScriptForTests(add_field_to_form.c_str());
 
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent identifies the first field as
   // username.
@@ -2244,8 +2254,8 @@
 
   // Simulate that JavaScript makes password field readonly.
   SetElementReadOnly(password_element_, true);
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SubmitForm();
 
   // Observe that the PasswordAutofillAgent can correctly process submitted
   // form.
@@ -2263,10 +2273,8 @@
 
   SimulateUsernameTyping("NewGuy");
   SimulatePasswordTyping("NewPassword");
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+
+  SaveAndSubmitForm();
 
   ExpectFormSubmittedWithUsernameAndPasswords("NewGuy", "NewPassword", "");
 }
@@ -2284,10 +2292,7 @@
   base::string16 password = base::ASCIIToUTF16("NewPass22");
   password_generation_->GeneratedPasswordAccepted(password);
 
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+  SaveAndSubmitForm();
 
   ExpectFormSubmittedWithUsernameAndPasswords(kAliceUsername, "NewPass22", "");
 }
@@ -2314,11 +2319,8 @@
   EXPECT_FALSE(password_element.ShouldRevealPassword());
   EXPECT_TRUE(password_element.IsAutofilled());
 
-  // Make a submission to be sure the autofilled values will be saved.
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+  SaveAndSubmitForm();
+
   ExpectFormSubmittedWithUsernameAndPasswords(kAliceUsername, kAlicePassword,
                                               "");
 }
@@ -2446,10 +2448,7 @@
   password_autofill_agent_->AutofillUsernameAndPasswordDataReceived(
       predictions);
 
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(form_element);
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(form_element);
+  SaveAndSubmitForm(form_element);
 
   base::RunLoop().RunUntilIdle();
   ASSERT_TRUE(fake_driver_.called_password_form_submitted_only_for_fallback());
@@ -2491,7 +2490,7 @@
       "username.style = 'display:none';";
   ExecuteJavaScriptForTests(hide_elements.c_str());
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   ExpectInPageNavigationWithUsernameAndPasswords(
       "Bob", "mypassword", "",
@@ -2506,7 +2505,7 @@
   SimulateUsernameTyping("Bob");
   SimulatePasswordTyping("mypassword");
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   std::string hide_elements =
       "var password = document.getElementById('password');"
@@ -2530,7 +2529,7 @@
   SimulateUsernameTyping("Bob");
   SimulatePasswordTyping("mypassword");
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   base::RunLoop().RunUntilIdle();
   ASSERT_FALSE(fake_driver_.called_password_form_submitted());
@@ -2559,7 +2558,8 @@
       "var captcha = document.getElementById('captcha');"
       "captcha.style = 'display:inline';";
   ExecuteJavaScriptForTests(show_captcha.c_str());
-  password_autofill_agent_->AJAXSucceeded();
+
+  FireAjaxSucceeded();
 
   base::RunLoop().RunUntilIdle();
   EXPECT_FALSE(fake_driver_.called_inpage_navigation());
@@ -2582,7 +2582,7 @@
   SimulateUsernameTyping("Bob");
   SimulatePasswordTyping("mypassword");
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   // Simulate captcha element show up right after AJAX completed.
   std::string show_captcha =
@@ -2620,7 +2620,8 @@
 
   // Simulate captcha element show up right before AJAX completed.
   captcha_element.SetAttribute("style", "display:inline;");
-  password_autofill_agent_->AJAXSucceeded();
+
+  FireAjaxSucceeded();
 
   base::RunLoop().RunUntilIdle();
   EXPECT_FALSE(fake_driver_.called_inpage_navigation());
@@ -2648,7 +2649,7 @@
   SimulateUsernameTyping("Bob");
   SimulatePasswordTyping("mypassword");
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   // Simulate captcha element show up right after AJAX completed.
   captcha_element.SetAttribute("style", "display:inline;");
@@ -2833,10 +2834,7 @@
                                                 ASCIIToUTF16(kBobUsername),
                                                 ASCIIToUTF16(kBobPassword));
 
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSendSubmitEvent(username_element_.Form());
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->WillSubmitForm(username_element_.Form());
+  SaveAndSubmitForm();
 
   // Observe that the PasswordAutofillAgent sends to the browser selected
   // credentials.
@@ -2880,7 +2878,7 @@
         "username.style = 'display:none';";
     ExecuteJavaScriptForTests(hide_elements.c_str());
 
-    password_autofill_agent_->AJAXSucceeded();
+    FireAjaxSucceeded();
 
     ExpectInPageNavigationWithUsernameAndPasswords(
         "Alice", "mypassword", "",
@@ -2897,7 +2895,7 @@
   SimulatePasswordTyping("mypassword");
   SimulateUsernameTyping("Alice");
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
 
   // Hide form elements to simulate successful login.
   std::string hide_elements =
@@ -2926,10 +2924,7 @@
     SimulatePasswordTyping("mypassword");
     SimulateUsernameFieldChange(change_source);
 
-    static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-        ->WillSendSubmitEvent(username_element_.Form());
-    static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-        ->WillSubmitForm(username_element_.Form());
+    SaveAndSubmitForm();
 
     ExpectFormSubmittedWithUsernameAndPasswords("Alice", "mypassword", "");
   }
@@ -3076,8 +3071,8 @@
       "form.parentNode.removeChild(form);";
   ExecuteJavaScriptForTests(remove_form.c_str());
 
-  static_cast<content::RenderFrameObserver*>(password_autofill_agent_)
-      ->DidCommitProvisionalLoad(false, true);
+  FireDidCommitProvisionalLoad();
+
   ExpectInPageNavigationWithUsernameAndPasswords(
       std::string(), "random", std::string(),
       PasswordForm::SubmissionIndicatorEvent::SAME_DOCUMENT_NAVIGATION);
@@ -3132,12 +3127,15 @@
   SimulateUsernameTyping("Bob");
   SimulatePasswordTyping("mypassword");
 
-  password_autofill_agent_->AJAXSucceeded();
+  FireAjaxSucceeded();
+
   base::RunLoop().RunUntilIdle();
 
   // Repeatedly occurring AJAX events without removing the input elements
   // shouldn't be treated as a password submission.
-  password_autofill_agent_->AJAXSucceeded();
+
+  FireAjaxSucceeded();
+
   base::RunLoop().RunUntilIdle();
 
   ASSERT_FALSE(fake_driver_.called_password_form_submitted());
diff --git a/components/autofill/content/renderer/BUILD.gn b/components/autofill/content/renderer/BUILD.gn
index b7acdc30..a35d8975 100644
--- a/components/autofill/content/renderer/BUILD.gn
+++ b/components/autofill/content/renderer/BUILD.gn
@@ -12,6 +12,8 @@
     "form_cache.h",
     "form_classifier.cc",
     "form_classifier.h",
+    "form_tracker.cc",
+    "form_tracker.h",
     "html_based_username_detector.cc",
     "html_based_username_detector.h",
     "html_based_username_detector_vocabulary.cc",
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index b06ffb7..528e12e2 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -8,7 +8,6 @@
 
 #include <tuple>
 
-#include "base/auto_reset.h"
 #include "base/bind.h"
 #include "base/command_line.h"
 #include "base/feature_list.h"
@@ -24,6 +23,7 @@
 #include "base/time/time.h"
 #include "build/build_config.h"
 #include "components/autofill/content/renderer/form_autofill_util.h"
+#include "components/autofill/content/renderer/form_tracker.h"
 #include "components/autofill/content/renderer/password_autofill_agent.h"
 #include "components/autofill/content/renderer/password_generation_agent.h"
 #include "components/autofill/content/renderer/renderer_save_password_progress_logger.h"
@@ -156,16 +156,19 @@
       is_generation_popup_possibly_visible_(false),
       is_user_gesture_required_(true),
       is_secure_context_required_(false),
+      form_tracker_(render_frame),
       binding_(this),
       weak_ptr_factory_(this) {
   render_frame->GetWebFrame()->SetAutofillClient(this);
   password_autofill_agent->SetAutofillAgent(this);
-
+  AddFormObserver(this);
   registry->AddInterface(
       base::Bind(&AutofillAgent::BindRequest, base::Unretained(this)));
 }
 
-AutofillAgent::~AutofillAgent() {}
+AutofillAgent::~AutofillAgent() {
+  RemoveFormObserver(this);
+}
 
 void AutofillAgent::BindRequest(mojom::AutofillAgentRequest request) {
   binding_.Bind(std::move(request));
@@ -185,39 +188,28 @@
   if (frame->Parent())
     return;  // Not a top-level navigation.
 
-  if (is_same_document_navigation) {
-    OnSameDocumentNavigationCompleted();
-  } else {
-    // Navigation to a new page or a page refresh.
+  if (is_same_document_navigation)
+    return;
 
-    // Do Finch testing to see how much regressions are caused by this leak fix
-    // (crbug/753071).
-    std::string group_name =
-        base::FieldTrialList::FindFullName("FixDocumentLeakInAutofillAgent");
-    if (base::StartsWith(group_name, "enabled",
-                         base::CompareCase::INSENSITIVE_ASCII)) {
-      element_.Reset();
-    }
+  // Navigation to a new page or a page refresh.
 
-    form_cache_.Reset();
-    submitted_forms_.clear();
-    last_interacted_form_.Reset();
-    formless_elements_user_edited_.clear();
+  // Do Finch testing to see how much regressions are caused by this leak fix
+  // (crbug/753071).
+  std::string group_name =
+      base::FieldTrialList::FindFullName("FixDocumentLeakInAutofillAgent");
+  if (base::StartsWith(group_name, "enabled",
+                       base::CompareCase::INSENSITIVE_ASCII)) {
+    element_.Reset();
   }
+
+  form_cache_.Reset();
+  ResetLastInteractedElements();
 }
 
 void AutofillAgent::DidFinishDocumentLoad() {
   ProcessForms();
 }
 
-void AutofillAgent::WillSendSubmitEvent(const WebFormElement& form) {
-  FireHostSubmitEvents(form, /*form_submitted=*/false);
-}
-
-void AutofillAgent::WillSubmitForm(const WebFormElement& form) {
-  FireHostSubmitEvents(form, /*form_submitted=*/true);
-}
-
 void AutofillAgent::DidChangeScrollOffset() {
   if (IsKeyboardAccessoryEnabled())
     return;
@@ -279,27 +271,18 @@
 }
 
 void AutofillAgent::FireHostSubmitEvents(const WebFormElement& form,
-                                         bool form_submitted) {
+                                         bool known_success) {
   FormData form_data;
   if (!form_util::ExtractFormData(form, &form_data))
     return;
 
-  FireHostSubmitEvents(form_data, form_submitted);
+  FireHostSubmitEvents(form_data, known_success);
 }
 
 void AutofillAgent::FireHostSubmitEvents(const FormData& form_data,
-                                         bool form_submitted) {
-  // We remember when we have fired this IPC for this form in this frame load,
-  // because forms with a submit handler may fire both WillSendSubmitEvent
-  // and WillSubmitForm, and we don't want duplicate messages.
-  if (!submitted_forms_.count(form_data)) {
-    GetAutofillDriver()->WillSubmitForm(form_data, base::TimeTicks::Now());
-    submitted_forms_.insert(form_data);
-  }
-
-  if (form_submitted) {
-    GetAutofillDriver()->FormSubmitted(form_data);
-  }
+                                         bool /*known_success*/) {
+  GetAutofillDriver()->WillSubmitForm(form_data, base::TimeTicks::Now());
+  GetAutofillDriver()->FormSubmitted(form_data);
 }
 
 void AutofillAgent::Shutdown() {
@@ -312,62 +295,24 @@
 }
 
 void AutofillAgent::SetUserGestureRequired(bool required) {
-  is_user_gesture_required_ = required;
+  form_tracker_.set_user_gesture_required(required);
 }
 
 void AutofillAgent::TextFieldDidChange(const WebFormControlElement& element) {
-  DCHECK(ToWebInputElement(&element) || form_util::IsTextAreaElement(element));
-
-  if (ignore_text_changes_)
-    return;
-
-  // Disregard text changes that aren't caused by user gestures or pastes. Note
-  // that pastes aren't necessarily user gestures because Blink's conception of
-  // user gestures is centered around creating new windows/tabs.
-  if (is_user_gesture_required_ && !IsUserGesture() &&
-      !render_frame()->IsPasting())
-    return;
-
-  // We post a task for doing the Autofill as the caret position is not set
-  // properly at this point (http://bugs.webkit.org/show_bug.cgi?id=16976) and
-  // it is needed to trigger autofill.
-  weak_ptr_factory_.InvalidateWeakPtrs();
-  base::ThreadTaskRunnerHandle::Get()->PostTask(
-      FROM_HERE, base::Bind(&AutofillAgent::TextFieldDidChangeImpl,
-                            weak_ptr_factory_.GetWeakPtr(), element));
+  form_tracker_.TextFieldDidChange(element);
 }
 
-void AutofillAgent::TextFieldDidChangeImpl(
-    const WebFormControlElement& element) {
-  // If the element isn't focused then the changes don't matter. This check is
-  // required to properly handle IME interactions.
-  if (!element.Focused())
+void AutofillAgent::OnTextFieldDidChange(const WebInputElement& element) {
+  if (password_generation_agent_ &&
+      password_generation_agent_->TextDidChangeInTextField(element)) {
+    is_popup_possibly_visible_ = true;
     return;
+  }
 
-  const WebInputElement* input_element = ToWebInputElement(&element);
-  if (input_element) {
-    // Remember the last form the user interacted with.
-    if (element.Form().IsNull()) {
-      formless_elements_user_edited_.insert(element);
-    } else {
-      last_interacted_form_ = element.Form();
-    }
-
-    // |password_autofill_agent_| keeps track of all text changes even if
-    // it isn't displaying UI.
-    password_autofill_agent_->UpdateStateForTextChange(*input_element);
-
-    if (password_generation_agent_ &&
-        password_generation_agent_->TextDidChangeInTextField(*input_element)) {
-      is_popup_possibly_visible_ = true;
-      return;
-    }
-
-    if (password_autofill_agent_->TextDidChangeInTextField(*input_element)) {
-      is_popup_possibly_visible_ = true;
-      element_ = element;
-      return;
-    }
+  if (password_autofill_agent_->TextDidChangeInTextField(element)) {
+    is_popup_possibly_visible_ = true;
+    element_ = element;
+    return;
   }
 
   ShowSuggestionsOptions options;
@@ -406,7 +351,8 @@
   if (!is_popup_possibly_visible_ || !element.Focused())
     return;
 
-  TextFieldDidChangeImpl(element);
+  OnProvisionallySaveForm(WebFormElement(), element,
+                          ElementChangeSource::TEXTFIELD_CHANGED);
 }
 
 void AutofillAgent::UserGestureObserved() {
@@ -564,32 +510,6 @@
   is_popup_possibly_visible_ = true;
 }
 
-void AutofillAgent::OnSameDocumentNavigationCompleted() {
-  if (last_interacted_form_.IsNull()) {
-    // If no last interacted form is available (i.e., there is no form tag),
-    // we check if all the elements the user has interacted with are gone,
-    // to decide if submission has occurred.
-    if (formless_elements_user_edited_.size() == 0 ||
-        form_util::IsSomeControlElementVisible(formless_elements_user_edited_))
-      return;
-
-    FormData constructed_form;
-    if (CollectFormlessElements(&constructed_form))
-      FireHostSubmitEvents(constructed_form, /*form_submitted=*/true);
-  } else {
-    // Otherwise, assume form submission only if the form is now gone, either
-    // invisible or removed from the DOM.
-    if (form_util::AreFormContentsVisible(last_interacted_form_))
-      return;
-
-    FireHostSubmitEvents(last_interacted_form_, /*form_submitted=*/true);
-  }
-
-  last_interacted_form_.Reset();
-  formless_elements_user_edited_.clear();
-  submitted_forms_.clear();
-}
-
 bool AutofillAgent::CollectFormlessElements(FormData* output) {
   WebDocument document = render_frame()->GetWebFrame()->GetDocument();
 
@@ -722,10 +642,11 @@
 
 void AutofillAgent::DoFillFieldWithValue(const base::string16& value,
                                          WebInputElement* node) {
-  base::AutoReset<bool> auto_reset(&ignore_text_changes_, true);
+  form_tracker_.set_ignore_text_changes(true);
   node->SetAutofillValue(
       blink::WebString::FromUTF16(value.substr(0, node->MaxLength())));
   password_autofill_agent_->UpdateStateForTextChange(*node);
+  form_tracker_.set_ignore_text_changes(false);
 }
 
 void AutofillAgent::DoPreviewFieldWithValue(const base::string16& value,
@@ -844,8 +765,103 @@
 }
 
 void AutofillAgent::AjaxSucceeded() {
-  OnSameDocumentNavigationCompleted();
-  password_autofill_agent_->AJAXSucceeded();
+  form_tracker_.AjaxSucceeded();
+}
+
+void AutofillAgent::OnProvisionallySaveForm(const WebFormElement& form,
+                                            const WebInputElement& element,
+                                            ElementChangeSource source) {
+  // Remember the last form the user interacted with.
+  if (source == ElementChangeSource::WILL_SEND_SUBMIT_EVENT) {
+    last_interacted_form_ = form;
+  } else if (source == ElementChangeSource::TEXTFIELD_CHANGED) {
+    if (!element.Form().IsNull()) {
+      last_interacted_form_ = element.Form();
+    } else {
+      // Remove invisible elements
+      for (auto it = formless_elements_user_edited_.begin();
+           it != formless_elements_user_edited_.end();) {
+        if (form_util::IsWebElementVisible(*it)) {
+          it = formless_elements_user_edited_.erase(it);
+        } else {
+          ++it;
+        }
+      }
+      formless_elements_user_edited_.insert(element);
+      constructed_form_.reset(new FormData());
+      if (!CollectFormlessElements(constructed_form_.get())) {
+        constructed_form_.reset();
+      } else {
+        last_interacted_form_.Reset();
+      }
+    }
+    OnTextFieldDidChange(element);
+  }
+}
+
+void AutofillAgent::OnProbablyFormSubmitted() {
+  // Uncomment below code once we check whether form submission
+  // is successful in browser side.
+  // FormData form_data;
+  // if (GetSubmittedForm(&form_data)) {
+  //   FireHostSubmitEvents(form_data, /*known_success=*/false);
+  // }
+  ResetLastInteractedElements();
+}
+
+void AutofillAgent::OnFormSubmitted(const WebFormElement& form) {
+  FireHostSubmitEvents(form, /*known_success=*/false);
+  ResetLastInteractedElements();
+}
+
+void AutofillAgent::OnInferredFormSubmission(SubmissionSource source) {
+  // Only handle iframe for FRAME_DETACHED or main frame for
+  // SAME_DOCUMENT_NAVIGATION.
+  if ((source == SubmissionSource::FRAME_DETACHED &&
+       !render_frame()->GetWebFrame()->Parent()) ||
+      (source == SubmissionSource::SAME_DOCUMENT_NAVIGATION &&
+       render_frame()->GetWebFrame()->Parent())) {
+    return;
+  }
+
+  FormData form_data;
+  if (GetSubmittedForm(&form_data)) {
+    FireHostSubmitEvents(form_data, /*known_success=*/true);
+  }
+  ResetLastInteractedElements();
+}
+
+void AutofillAgent::AddFormObserver(Observer* observer) {
+  form_tracker_.AddObserver(observer);
+}
+
+void AutofillAgent::RemoveFormObserver(Observer* observer) {
+  form_tracker_.RemoveObserver(observer);
+}
+
+bool AutofillAgent::GetSubmittedForm(FormData* form) {
+  if (!last_interacted_form_.IsNull()) {
+    return form_util::ExtractFormData(last_interacted_form_, form);
+  } else if (formless_elements_user_edited_.size() != 0 &&
+             !form_util::IsSomeControlElementVisible(
+                 formless_elements_user_edited_)) {
+    // we check if all the elements the user has interacted with are gone,
+    // to decide if submission has occurred, and use the constructed_form_
+    // saved in OnProvisionallySaveForm() if fail to construct form.
+    if (CollectFormlessElements(form)) {
+      return true;
+    } else if (constructed_form_) {
+      *form = *constructed_form_;
+      return true;
+    }
+  }
+  return false;
+}
+
+void AutofillAgent::ResetLastInteractedElements() {
+  last_interacted_form_.Reset();
+  formless_elements_user_edited_.clear();
+  constructed_form_.reset();
 }
 
 const mojom::AutofillDriverPtr& AutofillAgent::GetAutofillDriver() {
diff --git a/components/autofill/content/renderer/autofill_agent.h b/components/autofill/content/renderer/autofill_agent.h
index c5691fe3..44810de 100644
--- a/components/autofill/content/renderer/autofill_agent.h
+++ b/components/autofill/content/renderer/autofill_agent.h
@@ -16,6 +16,7 @@
 #include "components/autofill/content/common/autofill_agent.mojom.h"
 #include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/content/renderer/form_cache.h"
+#include "components/autofill/content/renderer/form_tracker.h"
 #include "content/public/renderer/render_frame_observer.h"
 #include "mojo/public/cpp/bindings/binding.h"
 #include "services/service_manager/public/cpp/binder_registry.h"
@@ -45,6 +46,7 @@
 // - entire form fill based on one field entry, referred to as Form Autofill.
 
 class AutofillAgent : public content::RenderFrameObserver,
+                      public FormTracker::Observer,
                       public blink::WebAutofillClient,
                       public mojom::AutofillAgent {
  public:
@@ -88,6 +90,23 @@
   void FormControlElementClicked(const blink::WebFormControlElement& element,
                                  bool was_focused);
 
+  base::WeakPtr<AutofillAgent> GetWeakPtr() {
+    return weak_ptr_factory_.GetWeakPtr();
+  }
+
+  // FormTracker::Observer
+  void OnProvisionallySaveForm(const blink::WebFormElement& form,
+                               const blink::WebInputElement& element,
+                               ElementChangeSource source) override;
+  void OnProbablyFormSubmitted() override;
+  void OnFormSubmitted(const blink::WebFormElement& form) override;
+  void OnInferredFormSubmission(SubmissionSource source) override;
+
+  void AddFormObserver(Observer* observer);
+  void RemoveFormObserver(Observer* observer);
+
+  FormTracker* form_tracker_for_testing() { return &form_tracker_; }
+
  protected:
   // blink::WebAutofillClient:
   void DidAssociateFormControlsDynamically() override;
@@ -133,20 +152,17 @@
   void DidCommitProvisionalLoad(bool is_new_navigation,
                                 bool is_same_document_navigation) override;
   void DidFinishDocumentLoad() override;
-  void WillSendSubmitEvent(const blink::WebFormElement& form) override;
-  void WillSubmitForm(const blink::WebFormElement& form) override;
   void DidChangeScrollOffset() override;
   void FocusedNodeChanged(const blink::WebNode& node) override;
   void OnDestruct() override;
 
-  // Fires IPC messages for a given form submission. Will always fire
-  // AutofillHostMsg_WillSubmitForm,  and will also fire
-  // AutofillHostMsg_FormSubmitted if |form_submitted| is true. Respects
-  // submitted_forms_ contents to ensure no duplicate submissions of
-  // AutofillHostMsg_WillSubmitForm.
+  // Fires Mojo messages for a given form submission. Will always fire
+  // AutofillHostMsg_WillSubmitForm and AutofillHostMsg_FormSubmitted
+  // in sequence.
+  // TODO(crbug.com/785519): Combine those two events to one.
   void FireHostSubmitEvents(const blink::WebFormElement& form,
-                            bool form_submitted);
-  void FireHostSubmitEvents(const FormData& form_data, bool form_submitted);
+                            bool known_success);
+  void FireHostSubmitEvents(const FormData& form_data, bool known_success);
 
   // Shuts the AutofillAgent down on RenderFrame deletion. Safe to call multiple
   // times.
@@ -168,17 +184,13 @@
 
   void HandleFocusChangeComplete();
 
-  // Called when a same-document navigation is detected.
-  void OnSameDocumentNavigationCompleted();
   // Helper method which collects unowned elements (i.e., those not inside a
   // form tag) and writes them into |output|. Returns true if the process is
   // successful, and all conditions for firing events are true.
   bool CollectFormlessElements(FormData* output);
   FRIEND_TEST_ALL_PREFIXES(FormAutocompleteTest, CollectFormlessElements);
 
-  // Called in a posted task by textFieldDidChange() to work-around a WebKit bug
-  // http://bugs.webkit.org/show_bug.cgi?id=16976
-  void TextFieldDidChangeImpl(const blink::WebFormControlElement& element);
+  void OnTextFieldDidChange(const blink::WebInputElement& element);
 
   // Shows the autofill suggestions for |element|. This call is asynchronous
   // and may or may not lead to the showing of a suggestion popup (no popup is
@@ -223,18 +235,23 @@
   // Hides any currently showing Autofill popup.
   void HidePopup();
 
+  // TODO(crbug.com/785524): Investigate why this method need to be mocked in
+  // chrome_render_view_test.cc, this isn't called now, but this is no test
+  // failed.
   // Returns true if the text field change is due to a user gesture. Can be
   // overriden in tests.
   virtual bool IsUserGesture() const;
 
+  // Attempt to get submitted FormData from last_interacted_form_ or
+  // constructed_form_, return true if |form| is set.
+  bool GetSubmittedForm(FormData* form);
+
+  void ResetLastInteractedElements();
+
   // Formerly cached forms for all frames, now only caches forms for the current
   // frame.
   FormCache form_cache_;
 
-  // Keeps track of the forms for which a "will submit" message has been sent in
-  // this frame's current load. We use a simplified comparison function.
-  std::set<FormData, FormDataCompare> submitted_forms_;
-
   PasswordAutofillAgent* password_autofill_agent_;      // Weak reference.
   PasswordGenerationAgent* password_generation_agent_;  // Weak reference.
 
@@ -253,7 +270,8 @@
 
   // When dealing with forms that don't use a <form> tag, we keep track of the
   // elements the user has modified so we can determine when submission occurs.
-  std::set<blink::WebFormControlElement> formless_elements_user_edited_;
+  std::set<blink::WebInputElement> formless_elements_user_edited_;
+  std::unique_ptr<FormData> constructed_form_;
 
   // Was the query node autofilled prior to previewing the form?
   bool was_query_node_autofilled_;
@@ -287,6 +305,8 @@
   blink::WebFormControlElement last_clicked_form_control_element_for_testing_;
   bool last_clicked_form_control_element_was_focused_for_testing_ = false;
 
+  FormTracker form_tracker_;
+
   mojo::Binding<mojom::AutofillAgent> binding_;
 
   mojom::AutofillDriverPtr autofill_driver_;
diff --git a/components/autofill/content/renderer/form_tracker.cc b/components/autofill/content/renderer/form_tracker.cc
new file mode 100644
index 0000000..7070c3e
--- /dev/null
+++ b/components/autofill/content/renderer/form_tracker.cc
@@ -0,0 +1,252 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/autofill/content/renderer/form_tracker.h"
+
+#include "components/autofill/content/renderer/form_autofill_util.h"
+#include "content/public/renderer/document_state.h"
+#include "content/public/renderer/navigation_state.h"
+#include "content/public/renderer/render_frame.h"
+#include "third_party/WebKit/public/web/WebInputElement.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
+#include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
+#include "third_party/WebKit/public/web/modules/password_manager/WebFormElementObserver.h"
+#include "third_party/WebKit/public/web/modules/password_manager/WebFormElementObserverCallback.h"
+#include "ui/base/page_transition_types.h"
+
+using blink::WebDocumentLoader;
+using blink::WebInputElement;
+using blink::WebFormControlElement;
+using blink::WebFormElement;
+
+namespace autofill {
+
+class FormTracker::FormElementObserverCallback
+    : public blink::WebFormElementObserverCallback {
+ public:
+  explicit FormElementObserverCallback(FormTracker* tracker)
+      : tracker_(tracker) {}
+  ~FormElementObserverCallback() override = default;
+
+  void ElementWasHiddenOrRemoved() override {
+    tracker_->FireInferredFormSubmission(
+        Observer::SubmissionSource::DOM_MUTATION_AFTER_XHR);
+  }
+
+ private:
+  FormTracker* tracker_;
+
+  DISALLOW_COPY_AND_ASSIGN(FormElementObserverCallback);
+};
+
+FormTracker::FormTracker(content::RenderFrame* render_frame)
+    : content::RenderFrameObserver(render_frame), weak_ptr_factory_(this) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+}
+
+FormTracker::~FormTracker() {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  ResetLastInteractedElements();
+}
+
+void FormTracker::AddObserver(Observer* observer) {
+  DCHECK(observer);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  observers_.AddObserver(observer);
+}
+
+void FormTracker::RemoveObserver(Observer* observer) {
+  DCHECK(observer);
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  observers_.RemoveObserver(observer);
+}
+
+void FormTracker::AjaxSucceeded() {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  FireSubmissionIfFormDisappear(Observer::SubmissionSource::XHR_SUCCEEDED);
+}
+
+void FormTracker::TextFieldDidChange(const WebFormControlElement& element) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  DCHECK(ToWebInputElement(&element) || form_util::IsTextAreaElement(element));
+
+  if (ignore_text_changes_)
+    return;
+
+  // Disregard text changes that aren't caused by user gestures or pastes. Note
+  // that pastes aren't necessarily user gestures because Blink's conception of
+  // user gestures is centered around creating new windows/tabs.
+  if (user_gesture_required_ &&
+      !blink::WebUserGestureIndicator::IsProcessingUserGesture() &&
+      !render_frame()->IsPasting())
+    return;
+
+  // We post a task for doing the Autofill as the caret position is not set
+  // properly at this point (http://bugs.webkit.org/show_bug.cgi?id=16976) and
+  // it is needed to trigger autofill.
+  weak_ptr_factory_.InvalidateWeakPtrs();
+  base::SequencedTaskRunnerHandle::Get()->PostTask(
+      FROM_HERE, base::Bind(&FormTracker::TextFieldDidChangeImpl,
+                            weak_ptr_factory_.GetWeakPtr(), element));
+}
+
+void FormTracker::TextFieldDidChangeImpl(const WebFormControlElement& element) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  // If the element isn't focused then the changes don't matter. This check is
+  // required to properly handle IME interactions.
+  if (!element.Focused())
+    return;
+
+  const WebInputElement* input_element = ToWebInputElement(&element);
+  if (!input_element)
+    return;
+
+  if (element.Form().IsNull()) {
+    last_interacted_formless_element_ = *input_element;
+  } else {
+    last_interacted_form_ = element.Form();
+  }
+
+  for (auto& observer : observers_) {
+    observer.OnProvisionallySaveForm(
+        element.Form(), *input_element,
+        Observer::ElementChangeSource::TEXTFIELD_CHANGED);
+  }
+}
+
+void FormTracker::DidCommitProvisionalLoad(bool is_new_navigation,
+                                           bool is_same_document_navigation) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  if (!is_same_document_navigation)
+    return;
+
+  FireSubmissionIfFormDisappear(
+      Observer::SubmissionSource::SAME_DOCUMENT_NAVIGATION);
+}
+
+void FormTracker::DidStartProvisionalLoad(WebDocumentLoader* document_loader) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  blink::WebLocalFrame* navigated_frame = render_frame()->GetWebFrame();
+  // Ony handle main frame.
+  if (navigated_frame->Parent())
+    return;
+
+  // Bug fix for crbug.com/368690. isProcessingUserGesture() is false when
+  // the user is performing actions outside the page (e.g. typed url,
+  // history navigation). We don't want to trigger saving in these cases.
+  content::DocumentState* document_state =
+      content::DocumentState::FromDocumentLoader(document_loader);
+  DCHECK(document_state);
+  if (!document_state)
+    return;
+
+  content::NavigationState* navigation_state =
+      document_state->navigation_state();
+
+  DCHECK(navigation_state);
+  if (!navigation_state)
+    return;
+
+  ui::PageTransition type = navigation_state->GetTransitionType();
+  if (ui::PageTransitionIsWebTriggerable(type) &&
+      ui::PageTransitionIsNewNavigation(type) &&
+      !blink::WebUserGestureIndicator::IsProcessingUserGesture(
+          navigated_frame)) {
+    FireProbablyFormSubmitted();
+  }
+}
+
+void FormTracker::FrameDetached() {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  FireInferredFormSubmission(Observer::SubmissionSource::FRAME_DETACHED);
+}
+
+void FormTracker::WillSendSubmitEvent(const WebFormElement& form) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  last_interacted_form_ = form;
+  for (auto& observer : observers_) {
+    observer.OnProvisionallySaveForm(
+        form, blink::WebInputElement(),
+        Observer::ElementChangeSource::WILL_SEND_SUBMIT_EVENT);
+  }
+}
+
+void FormTracker::WillSubmitForm(const WebFormElement& form) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  FireFormSubmitted(form);
+}
+
+void FormTracker::OnDestruct() {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  ResetLastInteractedElements();
+}
+
+void FormTracker::FireFormSubmitted(const blink::WebFormElement& form) {
+  for (auto& observer : observers_)
+    observer.OnFormSubmitted(form);
+  ResetLastInteractedElements();
+}
+
+void FormTracker::FireProbablyFormSubmitted() {
+  for (auto& observer : observers_)
+    observer.OnProbablyFormSubmitted();
+  ResetLastInteractedElements();
+}
+
+void FormTracker::FireInferredFormSubmission(
+    Observer::SubmissionSource source) {
+  DCHECK_CALLED_ON_VALID_SEQUENCE(form_tracker_sequence_checker_);
+  for (auto& observer : observers_)
+    observer.OnInferredFormSubmission(source);
+  ResetLastInteractedElements();
+}
+
+void FormTracker::FireSubmissionIfFormDisappear(
+    Observer::SubmissionSource source) {
+  if (CanInferFormSubmitted()) {
+    FireInferredFormSubmission(source);
+    return;
+  }
+  TrackElement();
+}
+
+bool FormTracker::CanInferFormSubmitted() {
+  // If last interacted form is available, assume form submission only if the
+  // form is now gone, either invisible or removed from the DOM.
+  // Otherwise (i.e., there is no form tag), we check if the last element the
+  // user has interacted with are gone, to decide if submission has occurred.
+  if (!last_interacted_form_.IsNull())
+    return !form_util::AreFormContentsVisible(last_interacted_form_);
+  else if (!last_interacted_formless_element_.IsNull())
+    return !form_util::IsWebElementVisible(last_interacted_formless_element_);
+
+  return false;
+}
+
+void FormTracker::TrackElement() {
+  // Already has observer for last interacted element.
+  if (form_element_observer_)
+    return;
+  std::unique_ptr<FormElementObserverCallback> callback =
+      std::make_unique<FormElementObserverCallback>(this);
+
+  if (!last_interacted_form_.IsNull()) {
+    form_element_observer_ = blink::WebFormElementObserver::Create(
+        last_interacted_form_, std::move(callback));
+  } else if (!last_interacted_formless_element_.IsNull()) {
+    form_element_observer_ = blink::WebFormElementObserver::Create(
+        last_interacted_formless_element_, std::move(callback));
+  }
+}
+
+void FormTracker::ResetLastInteractedElements() {
+  last_interacted_form_.Reset();
+  last_interacted_formless_element_.Reset();
+  if (form_element_observer_) {
+    form_element_observer_->Disconnect();
+    form_element_observer_ = nullptr;
+  }
+}
+
+}  // namespace autofill
diff --git a/components/autofill/content/renderer/form_tracker.h b/components/autofill/content/renderer/form_tracker.h
new file mode 100644
index 0000000..ba67c52d
--- /dev/null
+++ b/components/autofill/content/renderer/form_tracker.h
@@ -0,0 +1,127 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_TRACKER_H_
+#define COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_TRACKER_H_
+
+#include "base/memory/weak_ptr.h"
+#include "base/observer_list.h"
+#include "base/sequence_checker.h"
+#include "content/public/renderer/render_frame_observer.h"
+#include "third_party/WebKit/public/web/WebInputElement.h"
+
+namespace blink {
+class WebFormElementObserver;
+}
+
+namespace autofill {
+
+// TODO(crbug.com/785531): Track the select and checkbox change.
+// This class is used to track user's change of form or WebFormControlElement,
+// notifies observers of form's change and submission.
+class FormTracker : public content::RenderFrameObserver {
+ public:
+  // The interface implemented by observer to get notification of form's change
+  // and submission.
+  class Observer {
+   public:
+    // Probably should merge with PasswordForm::SubmissionIndicatorEvent.
+    enum class SubmissionSource {
+      SAME_DOCUMENT_NAVIGATION,
+      XHR_SUCCEEDED,
+      FRAME_DETACHED,
+      DOM_MUTATION_AFTER_XHR,
+    };
+
+    enum class ElementChangeSource {
+      TEXTFIELD_CHANGED,
+      WILL_SEND_SUBMIT_EVENT,
+    };
+
+    // Invoked when form needs to be saved because of |source|, |element| is
+    // valid if the callback caused by TEXTFIELD_CHANGED, |form| is valid for
+    // the callback caused by WILL_SEND_SUBMIT_EVENT.
+    virtual void OnProvisionallySaveForm(const blink::WebFormElement& form,
+                                         const blink::WebInputElement& element,
+                                         ElementChangeSource source) = 0;
+
+    // Invoked when the form is probably submitted, the submmited form could be
+    // the one saved in OnProvisionallySaveForm() or others in the page.
+    virtual void OnProbablyFormSubmitted() = 0;
+
+    // Invoked when |form| is submitted. The submission might not be successful,
+    // observer needs to check whether the form exists in new page.
+    virtual void OnFormSubmitted(const blink::WebFormElement& form) = 0;
+
+    // Invoked when tracker infers the last form or element saved in
+    // OnProvisionallySaveForm() is submitted from the |source|, the tracker
+    // infers submission from the disappearance of form or element, observer
+    // might not need to check it again.
+    virtual void OnInferredFormSubmission(SubmissionSource source) = 0;
+
+   protected:
+    virtual ~Observer() {}
+  };
+
+  FormTracker(content::RenderFrame* render_frame);
+  ~FormTracker() override;
+
+  void AddObserver(Observer* observer);
+  void RemoveObserver(Observer* observer);
+
+  // Same methods as those in blink::WebAutofillClient, but invoked by
+  // AutofillAgent.
+  void AjaxSucceeded();
+  void TextFieldDidChange(const blink::WebFormControlElement& element);
+
+  void set_ignore_text_changes(bool ignore_text_changes) {
+    ignore_text_changes_ = ignore_text_changes;
+  }
+
+  void set_user_gesture_required(bool required) {
+    user_gesture_required_ = required;
+  }
+
+ private:
+  class FormElementObserverCallback;
+
+  // content::RenderFrameObserver:
+  void DidCommitProvisionalLoad(bool is_new_navigation,
+                                bool is_same_document_navigation) override;
+  void DidStartProvisionalLoad(
+      blink::WebDocumentLoader* document_loader) override;
+  void FrameDetached() override;
+  void WillSendSubmitEvent(const blink::WebFormElement& form) override;
+  void WillSubmitForm(const blink::WebFormElement& form) override;
+  void OnDestruct() override;
+
+  // Called in a posted task by textFieldDidChange() to work-around a WebKit bug
+  // http://bugs.webkit.org/show_bug.cgi?id=16976
+  void TextFieldDidChangeImpl(const blink::WebFormControlElement& element);
+  void FireProbablyFormSubmitted();
+  void FireFormSubmitted(const blink::WebFormElement& form);
+  void FireInferredFormSubmission(Observer::SubmissionSource source);
+  void FireSubmissionIfFormDisappear(Observer::SubmissionSource source);
+  bool CanInferFormSubmitted();
+  void TrackElement();
+
+  void ResetLastInteractedElements();
+
+  base::ObserverList<Observer> observers_;
+  bool ignore_text_changes_ = false;
+  bool user_gesture_required_ = true;
+  blink::WebFormElement last_interacted_form_;
+  blink::WebInputElement last_interacted_formless_element_;
+  blink::WebFormElementObserver* form_element_observer_ = nullptr;
+
+  SEQUENCE_CHECKER(form_tracker_sequence_checker_);
+
+  base::WeakPtrFactory<FormTracker> weak_ptr_factory_;
+
+  DISALLOW_COPY_AND_ASSIGN(FormTracker);
+};
+
+}  // namespace autofill
+
+#endif  // COMPONENTS_AUTOFILL_CONTENT_RENDERER_FORM_TRACKER_H_
diff --git a/components/autofill/content/renderer/password_autofill_agent.cc b/components/autofill/content/renderer/password_autofill_agent.cc
index 508eb7f..7406343 100644
--- a/components/autofill/content/renderer/password_autofill_agent.cc
+++ b/components/autofill/content/renderer/password_autofill_agent.cc
@@ -51,8 +51,6 @@
 #include "third_party/WebKit/public/web/WebNode.h"
 #include "third_party/WebKit/public/web/WebUserGestureIndicator.h"
 #include "third_party/WebKit/public/web/WebView.h"
-#include "third_party/WebKit/public/web/modules/password_manager/WebFormElementObserver.h"
-#include "third_party/WebKit/public/web/modules/password_manager/WebFormElementObserverCallback.h"
 #include "ui/base/page_transition_types.h"
 #include "ui/events/keycodes/keyboard_codes.h"
 #include "url/gurl.h"
@@ -61,7 +59,7 @@
 namespace {
 
 // The size above which we stop triggering autocomplete.
-static const size_t kMaximumTextSizeForAutocomplete = 1000;
+const size_t kMaximumTextSizeForAutocomplete = 1000;
 
 const char kDummyUsernameField[] = "anonymous_username";
 const char kDummyPasswordField[] = "anonymous_password";
@@ -563,29 +561,30 @@
           password_manager::features::kEnableManualFallbacksFillingStandalone));
 }
 
-}  // namespace
-
-class PasswordAutofillAgent::FormElementObserverCallback
-    : public blink::WebFormElementObserverCallback {
- public:
-  explicit FormElementObserverCallback(PasswordAutofillAgent* agent)
-      : agent_(agent) {}
-  ~FormElementObserverCallback() override = default;
-
-  void ElementWasHiddenOrRemoved() override {
-    agent_->OnSameDocumentNavigationCompleted(
-        PasswordForm::SubmissionIndicatorEvent::DOM_MUTATION_AFTER_XHR);
+PasswordForm::SubmissionIndicatorEvent ToSubmissionIndicatorEvent(
+    FormTracker::Observer::SubmissionSource source) {
+  switch (source) {
+    case FormTracker::Observer::SubmissionSource::FRAME_DETACHED:
+      return PasswordForm::SubmissionIndicatorEvent::FRAME_DETACHED;
+    case FormTracker::Observer::SubmissionSource::SAME_DOCUMENT_NAVIGATION:
+      return PasswordForm::SubmissionIndicatorEvent::SAME_DOCUMENT_NAVIGATION;
+    case FormTracker::Observer::SubmissionSource::XHR_SUCCEEDED:
+      return PasswordForm::SubmissionIndicatorEvent::XHR_SUCCEEDED;
+    case FormTracker::Observer::SubmissionSource::DOM_MUTATION_AFTER_XHR:
+      return PasswordForm::SubmissionIndicatorEvent::DOM_MUTATION_AFTER_XHR;
+    default:
+      return PasswordForm::SubmissionIndicatorEvent::NONE;
   }
+}
 
- private:
-  PasswordAutofillAgent* agent_;
-
-  DISALLOW_COPY_AND_ASSIGN(FormElementObserverCallback);
-};
+}  // namespace
 
 ////////////////////////////////////////////////////////////////////////////////
 // PasswordAutofillAgent, public:
 
+const char kDebugAttributeForFormSignature[] = "form_signature";
+const char kDebugAttributeForFieldSignature[] = "field_signature";
+
 PasswordAutofillAgent::PasswordAutofillAgent(
     content::RenderFrame* render_frame,
     service_manager::BinderRegistry* registry)
@@ -597,17 +596,15 @@
       was_password_autofilled_(false),
       sent_request_to_store_(false),
       checked_safe_browsing_reputation_(false),
-      binding_(this),
-      form_element_observer_(nullptr) {
+      binding_(this) {
   registry->AddInterface(
       base::Bind(&PasswordAutofillAgent::BindRequest, base::Unretained(this)));
 }
 
 PasswordAutofillAgent::~PasswordAutofillAgent() {
-  if (form_element_observer_) {
-    form_element_observer_->Disconnect();
-    form_element_observer_ = nullptr;
-  }
+  AutofillAgent* agent = autofill_agent_.get();
+  if (agent)
+    agent->RemoveFormObserver(this);
 }
 
 void PasswordAutofillAgent::BindRequest(
@@ -616,7 +613,11 @@
 }
 
 void PasswordAutofillAgent::SetAutofillAgent(AutofillAgent* autofill_agent) {
-  autofill_agent_ = autofill_agent;
+  AutofillAgent* agent = autofill_agent_.get();
+  if (agent)
+    agent->RemoveFormObserver(this);
+  autofill_agent_ = autofill_agent->GetWeakPtr();
+  autofill_agent->AddFormObserver(this);
 }
 
 void PasswordAutofillAgent::SetPasswordGenerationAgent(
@@ -942,7 +943,9 @@
       }
 
       if (ShouldShowNotSecureWarning(element)) {
-        autofill_agent_->ShowNotSecureWarning(element);
+        AutofillAgent* agent = autofill_agent_.get();
+        if (agent)
+          agent->ShowNotSecureWarning(element);
         return true;
       }
     }
@@ -1012,12 +1015,7 @@
   SendPasswordForms(false /* only_visible */);
 }
 
-void PasswordAutofillAgent::AJAXSucceeded() {
-  OnSameDocumentNavigationCompleted(
-      PasswordForm::SubmissionIndicatorEvent::XHR_SUCCEEDED);
-}
-
-void PasswordAutofillAgent::OnSameDocumentNavigationCompleted(
+void PasswordAutofillAgent::FireSubmissionIfFormDisappear(
     PasswordForm::SubmissionIndicatorEvent event) {
   if (!provisionally_saved_form_.IsPasswordValid())
     return;
@@ -1038,27 +1036,12 @@
         (provisionally_saved_form_.form_element().IsNull() &&
          IsUnownedPasswordFormVisible(
              provisionally_saved_form_.input_element()))) {
-      if (!form_element_observer_) {
-        std::unique_ptr<FormElementObserverCallback> callback(
-            new FormElementObserverCallback(this));
-        if (!provisionally_saved_form_.form_element().IsNull()) {
-          form_element_observer_ = blink::WebFormElementObserver::Create(
-              provisionally_saved_form_.form_element(), std::move(callback));
-        } else if (!provisionally_saved_form_.input_element().IsNull()) {
-          form_element_observer_ = blink::WebFormElementObserver::Create(
-              provisionally_saved_form_.input_element(), std::move(callback));
-        }
-      }
       return;
     }
   }
 
   provisionally_saved_form_.SetSubmissionIndicatorEvent(event);
   GetPasswordManagerDriver()->InPageNavigation(password_form);
-  if (form_element_observer_) {
-    form_element_observer_->Disconnect();
-    form_element_observer_ = nullptr;
-  }
   provisionally_saved_form_.Reset();
 }
 
@@ -1222,15 +1205,12 @@
 void PasswordAutofillAgent::DidCommitProvisionalLoad(
     bool is_new_navigation,
     bool is_same_document_navigation) {
-  if (is_same_document_navigation) {
-    OnSameDocumentNavigationCompleted(
-        PasswordForm::SubmissionIndicatorEvent::SAME_DOCUMENT_NAVIGATION);
-  } else {
+  if (!is_same_document_navigation) {
     checked_safe_browsing_reputation_ = false;
   }
 }
 
-void PasswordAutofillAgent::FrameDetached() {
+void PasswordAutofillAgent::OnFrameDetached() {
   // If a sub frame has been destroyed while the user was entering information
   // into a password form, try to save the data. See https://crbug.com/450806
   // for examples of sites that perform login using this technique.
@@ -1245,26 +1225,8 @@
   FrameClosing();
 }
 
-void PasswordAutofillAgent::WillSendSubmitEvent(
+void PasswordAutofillAgent::OnWillSubmitForm(
     const blink::WebFormElement& form) {
-  // Forms submitted via XHR are not seen by WillSubmitForm if the default
-  // onsubmit handler is overridden. Such submission first gets detected in
-  // DidStartProvisionalLoad, which no longer knows about the particular form,
-  // and uses the candidate stored in |provisionally_saved_form_|.
-  //
-  // User-typed password will get stored to |provisionally_saved_form_| in
-  // TextDidChangeInTextField. Autofilled or JavaScript-copied passwords need to
-  // be saved here.
-  //
-  // Only non-empty passwords are saved here. Empty passwords were likely
-  // cleared by some scripts (http://crbug.com/28910, http://crbug.com/391693).
-  // Had the user cleared the password, |provisionally_saved_form_| would
-  // already have been updated in TextDidChangeInTextField.
-  ProvisionallySavePassword(form, blink::WebInputElement(),
-                            RESTRICTION_NON_EMPTY_PASSWORD);
-}
-
-void PasswordAutofillAgent::WillSubmitForm(const blink::WebFormElement& form) {
   std::unique_ptr<RendererSavePasswordProgressLogger> logger;
   if (logging_state_active_) {
     logger.reset(new RendererSavePasswordProgressLogger(
@@ -1317,10 +1279,6 @@
       }
     }
 
-    if (form_element_observer_) {
-      form_element_observer_->Disconnect();
-      form_element_observer_ = nullptr;
-    }
     provisionally_saved_form_.Reset();
   } else if (logger) {
     logger->LogMessage(Logger::STRING_FORM_IS_NOT_PASSWORD);
@@ -1351,6 +1309,15 @@
   // This is a new navigation, so require a new user gesture before filling in
   // passwords.
   gatekeeper_.Reset();
+}
+
+void PasswordAutofillAgent::OnProbablyFormSubmitted() {
+  std::unique_ptr<RendererSavePasswordProgressLogger> logger;
+  if (logging_state_active_) {
+    logger.reset(new RendererSavePasswordProgressLogger(
+        GetPasswordManagerDriver().get()));
+    logger->LogMessage(Logger::STRING_DID_START_PROVISIONAL_LOAD_METHOD);
+  }
 
   if (!FrameCanAccessPasswordManager()) {
     if (logger)
@@ -1358,82 +1325,63 @@
     return;
   }
 
-  // Bug fix for crbug.com/368690. isProcessingUserGesture() is false when
-  // the user is performing actions outside the page (e.g. typed url,
-  // history navigation). We don't want to trigger saving in these cases.
-  content::DocumentState* document_state =
-      content::DocumentState::FromDocumentLoader(document_loader);
-  content::NavigationState* navigation_state =
-      document_state->navigation_state();
-  ui::PageTransition type = navigation_state->GetTransitionType();
-  if (ui::PageTransitionIsWebTriggerable(type) &&
-      ui::PageTransitionIsNewNavigation(type) &&
-      !blink::WebUserGestureIndicator::IsProcessingUserGesture(
-          navigated_frame)) {
-    // If onsubmit has been called, try and save that form.
-    if (provisionally_saved_form_.IsSet()) {
+  // If onsubmit has been called, try and save that form.
+  if (provisionally_saved_form_.IsSet()) {
+    if (logger) {
+      logger->LogPasswordForm(Logger::STRING_PROVISIONALLY_SAVED_FORM_FOR_FRAME,
+                              provisionally_saved_form_.password_form());
+    }
+    provisionally_saved_form_.SetSubmissionIndicatorEvent(
+        PasswordForm::SubmissionIndicatorEvent::
+            PROVISIONALLY_SAVED_FORM_ON_START_PROVISIONAL_LOAD);
+    GetPasswordManagerDriver()->PasswordFormSubmitted(
+        provisionally_saved_form_.password_form());
+    provisionally_saved_form_.Reset();
+  } else {
+    std::vector<std::unique_ptr<PasswordForm>> possible_submitted_forms;
+    // Loop through the forms on the page looking for one that has been
+    // filled out. If one exists, try and save the credentials.
+    blink::WebVector<blink::WebFormElement> forms;
+    render_frame()->GetWebFrame()->GetDocument().Forms(forms);
+
+    bool password_forms_found = false;
+    for (const auto& form_element : forms) {
       if (logger) {
-        logger->LogPasswordForm(
-            Logger::STRING_PROVISIONALLY_SAVED_FORM_FOR_FRAME,
-            provisionally_saved_form_.password_form());
+        LogHTMLForm(logger.get(), Logger::STRING_FORM_FOUND_ON_PAGE,
+                    form_element);
       }
-      provisionally_saved_form_.SetSubmissionIndicatorEvent(
-          PasswordForm::SubmissionIndicatorEvent::
-              PROVISIONALLY_SAVED_FORM_ON_START_PROVISIONAL_LOAD);
-      GetPasswordManagerDriver()->PasswordFormSubmitted(
-          provisionally_saved_form_.password_form());
-      if (form_element_observer_) {
-        form_element_observer_->Disconnect();
-        form_element_observer_ = nullptr;
-      }
-      provisionally_saved_form_.Reset();
-    } else {
-      std::vector<std::unique_ptr<PasswordForm>> possible_submitted_forms;
-      // Loop through the forms on the page looking for one that has been
-      // filled out. If one exists, try and save the credentials.
-      blink::WebVector<blink::WebFormElement> forms;
-      render_frame()->GetWebFrame()->GetDocument().Forms(forms);
-
-      bool password_forms_found = false;
-      for (size_t i = 0; i < forms.size(); ++i) {
-        blink::WebFormElement form_element = forms[i];
-        if (logger) {
-          LogHTMLForm(logger.get(), Logger::STRING_FORM_FOUND_ON_PAGE,
-                      form_element);
-        }
-        std::unique_ptr<PasswordForm> form =
-            GetPasswordFormFromWebForm(form_element);
-        if (form) {
-          form->submission_event = PasswordForm::SubmissionIndicatorEvent::
-              FILLED_FORM_ON_START_PROVISIONAL_LOAD;
-          possible_submitted_forms.push_back(std::move(form));
-        }
-      }
-
       std::unique_ptr<PasswordForm> form =
-          GetPasswordFormFromUnownedInputElements();
+          GetPasswordFormFromWebForm(form_element);
       if (form) {
         form->submission_event = PasswordForm::SubmissionIndicatorEvent::
-            FILLED_INPUT_ELEMENTS_ON_START_PROVISIONAL_LOAD;
+            FILLED_FORM_ON_START_PROVISIONAL_LOAD;
         possible_submitted_forms.push_back(std::move(form));
       }
-
-      for (const auto& password_form : possible_submitted_forms) {
-        if (password_form && !password_form->username_value.empty() &&
-            FormContainsNonDefaultPasswordValue(*password_form)) {
-          password_forms_found = true;
-          if (logger) {
-            logger->LogPasswordForm(Logger::STRING_PASSWORD_FORM_FOUND_ON_PAGE,
-                                    *password_form);
-          }
-          GetPasswordManagerDriver()->PasswordFormSubmitted(*password_form);
-          break;
-        }
-      }
-
-      if (!password_forms_found && logger)
-        logger->LogMessage(Logger::STRING_PASSWORD_FORM_NOT_FOUND_ON_PAGE);
     }
+
+    std::unique_ptr<PasswordForm> form =
+        GetPasswordFormFromUnownedInputElements();
+    if (form) {
+      form->submission_event = PasswordForm::SubmissionIndicatorEvent::
+          FILLED_INPUT_ELEMENTS_ON_START_PROVISIONAL_LOAD;
+      possible_submitted_forms.push_back(std::move(form));
+    }
+
+    for (const auto& password_form : possible_submitted_forms) {
+      if (password_form && !password_form->username_value.empty() &&
+          FormContainsNonDefaultPasswordValue(*password_form)) {
+        password_forms_found = true;
+        if (logger) {
+          logger->LogPasswordForm(Logger::STRING_PASSWORD_FORM_FOUND_ON_PAGE,
+                                  *password_form);
+        }
+        GetPasswordManagerDriver()->PasswordFormSubmitted(*password_form);
+        break;
+      }
+    }
+
+    if (!password_forms_found && logger)
+      logger->LogMessage(Logger::STRING_PASSWORD_FORM_NOT_FOUND_ON_PAGE);
   }
 }
 
@@ -1661,7 +1609,7 @@
 
   if (user_input.IsPasswordField() && !user_input.IsAutofilled() &&
       !user_input.Value().IsEmpty()) {
-    GetAutofillDriver()->HidePopup();
+    HidePopup();
     return false;
   }
 
@@ -1689,7 +1637,7 @@
 bool PasswordAutofillAgent::ShowManualFallbackSuggestion(
     const blink::WebInputElement& element) {
   if (!element.Value().IsEmpty()) {
-    GetAutofillDriver()->HidePopup();
+    HidePopup();
     return false;
   }
 
@@ -1707,10 +1655,6 @@
     password_to_username_.erase(iter.second.password_field);
   }
   web_input_to_password_info_.clear();
-  if (form_element_observer_) {
-    form_element_observer_->Disconnect();
-    form_element_observer_ = nullptr;
-  }
   provisionally_saved_form_.Reset();
   field_value_and_properties_map_.clear();
   username_detector_cache_.clear();
@@ -1918,9 +1862,54 @@
       registration_callback, logger);
 }
 
-const mojom::AutofillDriverPtr& PasswordAutofillAgent::GetAutofillDriver() {
-  DCHECK(autofill_agent_);
-  return autofill_agent_->GetAutofillDriver();
+void PasswordAutofillAgent::OnProvisionallySaveForm(
+    const blink::WebFormElement& form,
+    const blink::WebInputElement& element,
+    ElementChangeSource source) {
+  if (source == ElementChangeSource::TEXTFIELD_CHANGED) {
+    // keeps track of all text changes even if it isn't displaying UI.
+    UpdateStateForTextChange(element);
+    return;
+  }
+
+  DCHECK_EQ(ElementChangeSource::WILL_SEND_SUBMIT_EVENT, source);
+  // Forms submitted via XHR are not seen by WillSubmitForm if the default
+  // onsubmit handler is overridden. Such submission first gets detected in
+  // DidStartProvisionalLoad, which no longer knows about the particular form,
+  // and uses the candidate stored in |provisionally_saved_form_|.
+  //
+  // User-typed password will get stored to |provisionally_saved_form_| in
+  // TextDidChangeInTextField. Autofilled or JavaScript-copied passwords need to
+  // be saved here.
+  //
+  // Only non-empty passwords are saved here. Empty passwords were likely
+  // cleared by some scripts (http://crbug.com/28910, http://crbug.com/391693).
+  // Had the user cleared the password, |provisionally_saved_form_| would
+  // already have been updated in TextDidChangeInTextField.
+  ProvisionallySavePassword(form, element, RESTRICTION_NON_EMPTY_PASSWORD);
+}
+
+void PasswordAutofillAgent::OnFormSubmitted(const blink::WebFormElement& form) {
+  OnWillSubmitForm(form);
+}
+
+void PasswordAutofillAgent::OnInferredFormSubmission(SubmissionSource source) {
+  if (source == SubmissionSource::FRAME_DETACHED) {
+    OnFrameDetached();
+  } else {
+    PasswordForm::SubmissionIndicatorEvent event =
+        ToSubmissionIndicatorEvent(source);
+    if (event == PasswordForm::SubmissionIndicatorEvent::NONE)
+      return;
+    FireSubmissionIfFormDisappear(event);
+  }
+}
+
+void PasswordAutofillAgent::HidePopup() {
+  AutofillAgent* agent = autofill_agent_.get();
+  if (agent) {
+    autofill_agent_->GetAutofillDriver()->HidePopup();
+  }
 }
 
 const mojom::PasswordManagerDriverPtr&
diff --git a/components/autofill/content/renderer/password_autofill_agent.h b/components/autofill/content/renderer/password_autofill_agent.h
index d24fe73..5df0f36 100644
--- a/components/autofill/content/renderer/password_autofill_agent.h
+++ b/components/autofill/content/renderer/password_autofill_agent.h
@@ -10,10 +10,12 @@
 #include <vector>
 
 #include "base/macros.h"
+#include "base/memory/weak_ptr.h"
 #include "build/build_config.h"
 #include "components/autofill/content/common/autofill_agent.mojom.h"
 #include "components/autofill/content/common/autofill_driver.mojom.h"
 #include "components/autofill/content/renderer/autofill_agent.h"
+#include "components/autofill/content/renderer/form_tracker.h"
 #include "components/autofill/content/renderer/html_based_username_detector.h"
 #include "components/autofill/content/renderer/password_form_conversion_utils.h"
 #include "components/autofill/content/renderer/provisionally_saved_password_form.h"
@@ -32,21 +34,21 @@
 #endif
 
 namespace blink {
-class WebFormElementObserver;
 class WebInputElement;
 }
 
 namespace autofill {
 
 // Names of HTML attributes to show form and field signatures for debugging.
-const char kDebugAttributeForFormSignature[] = "form_signature";
-const char kDebugAttributeForFieldSignature[] = "field_signature";
+extern const char kDebugAttributeForFormSignature[];
+extern const char kDebugAttributeForFieldSignature[];
 
 class RendererSavePasswordProgressLogger;
 class PasswordGenerationAgent;
 
 // This class is responsible for filling password forms.
 class PasswordAutofillAgent : public content::RenderFrameObserver,
+                              public FormTracker::Observer,
                               public mojom::PasswordAutofillAgent {
  public:
   PasswordAutofillAgent(content::RenderFrame* render_frame,
@@ -71,6 +73,14 @@
       FindFocusedPasswordFormCallback callback) override;
   void BlacklistedFormFound() override;
 
+  // FormTracker::Observer
+  void OnProvisionallySaveForm(const blink::WebFormElement& form,
+                               const blink::WebInputElement& element,
+                               ElementChangeSource source) override;
+  void OnProbablyFormSubmitted() override;
+  void OnFormSubmitted(const blink::WebFormElement& form) override;
+  void OnInferredFormSubmission(SubmissionSource source) override;
+
   // WebFrameClient editor related calls forwarded by AutofillAgent.
   // If they return true, it indicates the event was consumed and should not
   // be used for any other autofill activity.
@@ -132,10 +142,6 @@
   // Called when new form controls are inserted.
   void OnDynamicFormsSeen();
 
-  // Called when an AJAX has succesfully completed. Used to determine if
-  // a form has been submitted by AJAX without navigation.
-  void AJAXSucceeded();
-
   // Called when the user interacts with the page after a load. This is a
   // signal to make autofilled values of password input elements accessible to
   // JavaScript.
@@ -170,8 +176,6 @@
   virtual bool FrameCanAccessPasswordManager();
 
  private:
-  class FormElementObserverCallback;
-
   // Ways to restrict which passwords are saved in ProvisionallySavePassword.
   enum ProvisionallySaveRestriction {
     RESTRICTION_NONE,
@@ -227,14 +231,11 @@
   // RenderFrameObserver:
   void DidFinishDocumentLoad() override;
   void DidFinishLoad() override;
-  void FrameDetached() override;
   void DidStartProvisionalLoad(
       blink::WebDocumentLoader* document_loader) override;
   void WillCommitProvisionalLoad() override;
   void DidCommitProvisionalLoad(bool is_new_navigation,
                                 bool is_same_document_navigation) override;
-  void WillSendSubmitEvent(const blink::WebFormElement& form) override;
-  void WillSubmitForm(const blink::WebFormElement& form) override;
   void OnDestruct() override;
 
   // Scans the given frame for password forms and sends them up to the browser.
@@ -313,11 +314,14 @@
       base::Callback<void(blink::WebInputElement*)> registration_callback,
       RendererSavePasswordProgressLogger* logger);
 
-  // Helper function called when same-document navigation completed
-  void OnSameDocumentNavigationCompleted(
+  // Helper function called when form submission is successful.
+  void FireSubmissionIfFormDisappear(
       PasswordForm::SubmissionIndicatorEvent event);
 
-  const mojom::AutofillDriverPtr& GetAutofillDriver();
+  void OnFrameDetached();
+  void OnWillSubmitForm(const blink::WebFormElement& form);
+
+  void HidePopup();
 
   // The logins we have filled so far with their associated info.
   WebInputToPasswordInfoMap web_input_to_password_info_;
@@ -365,7 +369,8 @@
   // username predictions.
   UsernameDetectorCache username_detector_cache_;
 
-  AutofillAgent* autofill_agent_;  // Weak reference.
+  base::WeakPtr<AutofillAgent> autofill_agent_;
+
   PasswordGenerationAgent* password_generation_agent_;  // Weak reference.
 
 #if !defined(OS_ANDROID) && !defined(OS_IOS)
@@ -376,8 +381,6 @@
 
   mojo::Binding<mojom::PasswordAutofillAgent> binding_;
 
-  blink::WebFormElementObserver* form_element_observer_;
-
   bool blacklisted_form_found_ = false;
 
   DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);
diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc
index 3052070..cd752be 100644
--- a/content/browser/frame_host/render_widget_host_view_guest.cc
+++ b/content/browser/frame_host/render_widget_host_view_guest.cc
@@ -33,6 +33,7 @@
 #include "content/public/common/content_switches.h"
 #include "gpu/ipc/common/gpu_messages.h"
 #include "skia/ext/platform_canvas.h"
+#include "ui/base/ui_base_switches_util.h"
 #include "ui/events/base_event_utils.h"
 #include "ui/gfx/geometry/dip_util.h"
 
@@ -400,7 +401,7 @@
 void RenderWidgetHostViewGuest::OnAttached() {
   RegisterFrameSinkId();
 #if defined(USE_AURA)
-  if (IsUsingMus()) {
+  if (switches::IsMusHostingViz()) {
     aura::Env::GetInstance()->ScheduleEmbed(
         GetWindowTreeClientFromRenderer(),
         base::BindOnce(&RenderWidgetHostViewGuest::OnGotEmbedToken,
diff --git a/content/browser/web_contents/web_contents_view_aura.cc b/content/browser/web_contents/web_contents_view_aura.cc
index ee18b4d..ceafaba 100644
--- a/content/browser/web_contents/web_contents_view_aura.cc
+++ b/content/browser/web_contents/web_contents_view_aura.cc
@@ -69,6 +69,7 @@
 #include "ui/base/dragdrop/os_exchange_data.h"
 #include "ui/base/dragdrop/os_exchange_data_provider_factory.h"
 #include "ui/base/hit_test.h"
+#include "ui/base/ui_base_switches_util.h"
 #include "ui/compositor/layer.h"
 #include "ui/display/display.h"
 #include "ui/display/screen.h"
@@ -529,8 +530,9 @@
 
 WebContentsViewAura::WebContentsViewAura(WebContentsImpl* web_contents,
                                          WebContentsViewDelegate* delegate)
-    : is_mus_browser_plugin_guest_(
-          web_contents->GetBrowserPluginGuest() != nullptr && IsUsingMus()),
+    : is_mus_browser_plugin_guest_(web_contents->GetBrowserPluginGuest() !=
+                                       nullptr &&
+                                   (switches::IsMusHostingViz())),
       web_contents_(web_contents),
       delegate_(delegate),
       current_drag_op_(blink::kWebDragOperationNone),
diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc
index f1370d2..227a66c7 100644
--- a/content/browser/web_contents/web_contents_view_guest.cc
+++ b/content/browser/web_contents/web_contents_view_guest.cc
@@ -20,6 +20,7 @@
 #include "content/public/browser/web_contents_delegate.h"
 #include "content/public/common/context_menu_params.h"
 #include "content/public/common/drop_data.h"
+#include "ui/base/ui_base_switches_util.h"
 #include "ui/gfx/geometry/point.h"
 #include "ui/gfx/geometry/rect.h"
 #include "ui/gfx/geometry/size.h"
@@ -78,14 +79,14 @@
   // view hierarchy. We add this view as embedder's child here.
   // This would go in WebContentsViewGuest::CreateView, but that is too early to
   // access embedder_web_contents(). Therefore, we do it here.
-  if (!IsUsingMus())
+  if (!switches::IsMusHostingViz())
     parent_view->GetNativeView()->AddChild(platform_view_->GetNativeView());
 #endif  // defined(USE_AURA)
 }
 
 void WebContentsViewGuest::OnGuestDetached(WebContentsView* old_parent_view) {
 #if defined(USE_AURA)
-  if (!IsUsingMus()) {
+  if (!switches::IsMusHostingViz()) {
     old_parent_view->GetNativeView()->RemoveChild(
         platform_view_->GetNativeView());
   }
diff --git a/content/renderer/browser_plugin/browser_plugin.cc b/content/renderer/browser_plugin/browser_plugin.cc
index 95f5aa5..55eaf81 100644
--- a/content/renderer/browser_plugin/browser_plugin.cc
+++ b/content/renderer/browser_plugin/browser_plugin.cc
@@ -46,6 +46,7 @@
 #include "third_party/WebKit/public/web/WebLocalFrame.h"
 #include "third_party/WebKit/public/web/WebPluginContainer.h"
 #include "third_party/WebKit/public/web/WebView.h"
+#include "ui/base/ui_base_switches_util.h"
 #include "ui/events/keycodes/keyboard_codes.h"
 
 #if defined(USE_AURA)
@@ -141,7 +142,7 @@
     int browser_plugin_instance_id,
     const viz::SurfaceInfo& surface_info,
     const viz::SurfaceSequence& sequence) {
-  if (!attached() || IsRunningWithMus())
+  if (!attached() || switches::IsMusHostingViz())
     return;
 
   if (!enable_surface_synchronization_) {
@@ -359,7 +360,7 @@
 void BrowserPlugin::OnSetMusEmbedToken(
     int instance_id,
     const base::UnguessableToken& embed_token) {
-  DCHECK(IsRunningWithMus());
+  DCHECK(switches::IsMusHostingViz());
   if (!attached_) {
     pending_embed_token_ = embed_token;
   } else {
diff --git a/content/test/url_loader_interceptor_test.cc b/content/test/url_loader_interceptor_test.cc
index 9e81a52fa..42d37e5 100644
--- a/content/test/url_loader_interceptor_test.cc
+++ b/content/test/url_loader_interceptor_test.cc
@@ -5,6 +5,7 @@
 #include "content/public/test/url_loader_interceptor.h"
 #include "base/command_line.h"
 #include "base/single_thread_task_runner.h"
+#include "base/test/bind_test_util.h"
 #include "base/threading/thread_task_runner_handle.h"
 #include "build/build_config.h"
 #include "content/public/browser/render_frame_host.h"
@@ -70,17 +71,16 @@
     return;  // Depends on http://crbug.com/747130.
 
   bool seen = false;
+  GURL url = GetPageURL();
   URLLoaderInterceptor interceptor(
-      base::Bind(
-          [](bool* seen, const GURL& url,
-             URLLoaderInterceptor::RequestParams* params) {
+      base::BindLambdaForTesting(
+          [&](URLLoaderInterceptor::RequestParams* params) {
             EXPECT_EQ(params->url_request.url, url);
             EXPECT_EQ(params->process_id, 0);
-            EXPECT_FALSE(*seen);
-            *seen = true;
+            EXPECT_FALSE(seen);
+            seen = true;
             return false;
-          },
-          &seen, GetPageURL()),
+          }),
       GetStoragePartition(), true, false);
   Test();
   EXPECT_TRUE(seen);
@@ -90,17 +90,17 @@
   if (!base::FeatureList::IsEnabled(features::kNetworkService))
     return;  // Depends on http://crbug.com/747130.
 
+  GURL url = GetPageURL();
   URLLoaderInterceptor interceptor(
-      base::Bind(
-          [](const GURL& url, URLLoaderInterceptor::RequestParams* params) {
+      base::BindLambdaForTesting(
+          [&](URLLoaderInterceptor::RequestParams* params) {
             EXPECT_EQ(params->url_request.url, url);
             EXPECT_EQ(params->process_id, 0);
             network::URLLoaderCompletionStatus status;
             status.error_code = net::ERR_FAILED;
             params->client->OnComplete(status);
             return true;
-          },
-          GetPageURL()),
+          }),
       GetStoragePartition(), true, false);
   EXPECT_FALSE(NavigateToURL(shell(), GetPageURL()));
 }
@@ -110,17 +110,16 @@
     return;  // Very deprecated non-plznavigate code path not supported.
 
   bool seen = false;
+  GURL url = GetImageURL();
   URLLoaderInterceptor interceptor(
-      base::Bind(
-          [](bool* seen, const GURL& url,
-             URLLoaderInterceptor::RequestParams* params) {
+      base::BindLambdaForTesting(
+          [&](URLLoaderInterceptor::RequestParams* params) {
             EXPECT_EQ(params->url_request.url, url);
             EXPECT_NE(params->process_id, 0);
-            EXPECT_FALSE(*seen);
-            *seen = true;
+            EXPECT_FALSE(seen);
+            seen = true;
             return false;
-          },
-          &seen, GetImageURL()),
+          }),
       GetStoragePartition(), false, true);
   Test();
   EXPECT_TRUE(seen);
@@ -131,16 +130,16 @@
   if (!IsBrowserSideNavigationEnabled())
     return;  // Very deprecated non-plznavigate code path not supported.
 
+  GURL url = GetImageURL();
   URLLoaderInterceptor interceptor(
-      base::Bind(
-          [](const GURL& url, URLLoaderInterceptor::RequestParams* params) {
+      base::BindLambdaForTesting(
+          [&](URLLoaderInterceptor::RequestParams* params) {
             EXPECT_EQ(params->url_request.url, url);
             network::URLLoaderCompletionStatus status;
             status.error_code = net::ERR_FAILED;
             params->client->OnComplete(status);
             return true;
-          },
-          GetImageURL()),
+          }),
       GetStoragePartition(), false, true);
   Test();
   EXPECT_FALSE(DidImageLoad());
diff --git a/gpu/config/gpu_test_config.cc b/gpu/config/gpu_test_config.cc
index 9799509..5e07aaf8 100644
--- a/gpu/config/gpu_test_config.cc
+++ b/gpu/config/gpu_test_config.cc
@@ -79,8 +79,7 @@
 }  // namespace anonymous
 
 GPUTestConfig::GPUTestConfig()
-    : validate_gpu_info_(true),
-      os_(kOsUnknown),
+    : os_(kOsUnknown),
       gpu_device_id_(0),
       build_type_(kBuildTypeUnknown),
       api_(kAPIUnknown) {}
@@ -117,8 +116,6 @@
 }
 
 bool GPUTestConfig::IsValid() const {
-  if (!validate_gpu_info_)
-    return true;
   if (gpu_device_id_ != 0 && (gpu_vendor_.size() != 1 || gpu_vendor_[0] == 0))
     return false;
   return true;
@@ -153,10 +150,6 @@
   return true;
 }
 
-void GPUTestConfig::DisableGPUInfoValidation() {
-  validate_gpu_info_ = false;
-}
-
 void GPUTestConfig::ClearGPUVendor() {
   gpu_vendor_.clear();
 }
@@ -170,7 +163,6 @@
 }
 
 bool GPUTestBotConfig::SetGPUInfo(const GPUInfo& gpu_info) {
-  DCHECK(validate_gpu_info_);
   if (gpu_info.gpu.device_id == 0 || gpu_info.gpu.vendor_id == 0)
     return false;
   ClearGPUVendor();
@@ -202,12 +194,10 @@
     default:
       return false;
   }
-  if (validate_gpu_info_) {
-    if (gpu_vendor().size() != 1 || gpu_vendor()[0] == 0)
-      return false;
-    if (gpu_device_id() == 0)
-      return false;
-  }
+  if (gpu_vendor().size() != 1 || gpu_vendor()[0] == 0)
+    return false;
+  if (gpu_device_id() == 0)
+    return false;
   switch (build_type()) {
     case kBuildTypeRelease:
     case kBuildTypeDebug:
@@ -261,8 +251,7 @@
     CollectInfoResult result = CollectBasicGraphicsInfo(&my_gpu_info);
     if (result != kCollectInfoSuccess) {
       LOG(ERROR) << "Fail to identify GPU";
-      DisableGPUInfoValidation();
-      rt = true;
+      rt = false;
     } else {
       rt = SetGPUInfo(my_gpu_info);
     }
diff --git a/gpu/config/gpu_test_config.h b/gpu/config/gpu_test_config.h
index 66f46fc..d92d2bcd 100644
--- a/gpu/config/gpu_test_config.h
+++ b/gpu/config/gpu_test_config.h
@@ -83,16 +83,9 @@
   // both configs.
   bool OverlapsWith(const GPUTestConfig& config) const;
 
-  // Disable validation of GPU vendor and device ids.
-  void DisableGPUInfoValidation();
-
  protected:
   void ClearGPUVendor();
 
-  // Indicates that the OS has the notion of a numeric GPU vendor and device id
-  // and this data should be validated.
-  bool validate_gpu_info_;
-
  private:
   // operating system.
   int32_t os_;
diff --git a/ios/chrome/browser/autofill/BUILD.gn b/ios/chrome/browser/autofill/BUILD.gn
index 379313f3..de03e87 100644
--- a/ios/chrome/browser/autofill/BUILD.gn
+++ b/ios/chrome/browser/autofill/BUILD.gn
@@ -5,6 +5,8 @@
 source_set("autofill") {
   configs += [ "//build/config/compiler:enable_arc" ]
   sources = [
+    "address_normalizer_factory.cc",
+    "address_normalizer_factory.h",
     "form_input_accessory_view.h",
     "form_input_accessory_view.mm",
     "form_input_accessory_view_controller.h",
diff --git a/ios/chrome/browser/autofill/address_normalizer_factory.cc b/ios/chrome/browser/autofill/address_normalizer_factory.cc
new file mode 100644
index 0000000..e7a1647
--- /dev/null
+++ b/ios/chrome/browser/autofill/address_normalizer_factory.cc
@@ -0,0 +1,45 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ios/chrome/browser/autofill/address_normalizer_factory.h"
+
+#include "ios/chrome/browser/application_context.h"
+#include "ios/chrome/browser/autofill/validation_rules_storage_factory.h"
+#include "third_party/libaddressinput/chromium/chrome_metadata_source.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/source.h"
+#include "third_party/libaddressinput/src/cpp/include/libaddressinput/storage.h"
+
+namespace autofill {
+namespace {
+
+std::unique_ptr<::i18n::addressinput::Source> GetAddressInputSource(
+    net::URLRequestContextGetter* url_context_getter) {
+  return std::unique_ptr<::i18n::addressinput::Source>(
+      new autofill::ChromeMetadataSource(I18N_ADDRESS_VALIDATION_DATA_URL,
+                                         url_context_getter));
+}
+
+std::unique_ptr<::i18n::addressinput::Storage> GetAddressInputStorage() {
+  return autofill::ValidationRulesStorageFactory::CreateStorage();
+}
+
+}  // namespace
+
+// static
+AddressNormalizer* AddressNormalizerFactory::GetInstance() {
+  static base::LazyInstance<AddressNormalizerFactory>::DestructorAtExit
+      instance = LAZY_INSTANCE_INITIALIZER;
+  return &(instance.Get().address_normalizer_);
+}
+
+AddressNormalizerFactory::AddressNormalizerFactory()
+    : address_normalizer_(
+          GetAddressInputSource(
+              GetApplicationContext()->GetSystemURLRequestContext()),
+          GetAddressInputStorage(),
+          GetApplicationContext()->GetApplicationLocale()) {}
+
+AddressNormalizerFactory::~AddressNormalizerFactory() {}
+
+}  // namespace autofill
diff --git a/ios/chrome/browser/autofill/address_normalizer_factory.h b/ios/chrome/browser/autofill/address_normalizer_factory.h
new file mode 100644
index 0000000..7c0fac3
--- /dev/null
+++ b/ios/chrome/browser/autofill/address_normalizer_factory.h
@@ -0,0 +1,33 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_AUTOFILL_ADDRESS_NORMALIZER_FACTORY_H_
+#define IOS_CHROME_BROWSER_AUTOFILL_ADDRESS_NORMALIZER_FACTORY_H_
+
+#include "base/lazy_instance.h"
+#include "base/macros.h"
+#include "components/autofill/core/browser/address_normalizer_impl.h"
+
+namespace autofill {
+
+// Singleton that owns a single AddressNormalizerImpl instance.
+class AddressNormalizerFactory {
+ public:
+  static AddressNormalizer* GetInstance();
+
+ private:
+  friend struct base::LazyInstanceTraitsBase<AddressNormalizerFactory>;
+
+  AddressNormalizerFactory();
+  ~AddressNormalizerFactory();
+
+  // The only instance that exists.
+  AddressNormalizerImpl address_normalizer_;
+
+  DISALLOW_COPY_AND_ASSIGN(AddressNormalizerFactory);
+};
+
+}  // namespace autofill
+
+#endif  // IOS_CHROME_BROWSER_AUTOFILL_ADDRESS_NORMALIZER_FACTORY_H_
diff --git a/ios/chrome/browser/browser_state/BUILD.gn b/ios/chrome/browser/browser_state/BUILD.gn
index 6a8cd58..f38011f 100644
--- a/ios/chrome/browser/browser_state/BUILD.gn
+++ b/ios/chrome/browser/browser_state/BUILD.gn
@@ -108,6 +108,8 @@
     "//ios/chrome/browser/translate",
     "//ios/chrome/browser/ui/browser_list",
     "//ios/chrome/browser/ui/browser_list:browser_list_impl",
+    "//ios/chrome/browser/ui/fullscreen",
+    "//ios/chrome/browser/ui/fullscreen:new_fullscreen",
     "//ios/chrome/browser/undo",
     "//ios/net",
     "//ios/public/provider/chrome/browser",
diff --git a/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm b/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm
index 018f1d7e..16afafd 100644
--- a/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm
+++ b/ios/chrome/browser/browser_state/browser_state_keyed_service_factories.mm
@@ -4,6 +4,7 @@
 
 #include "ios/chrome/browser/browser_state/browser_state_keyed_service_factories.h"
 
+#include "base/feature_list.h"
 #include "ios/chrome/browser/autocomplete/autocomplete_classifier_factory.h"
 #include "ios/chrome/browser/autocomplete/in_memory_url_index_factory.h"
 #include "ios/chrome/browser/autocomplete/shortcuts_backend_factory.h"
@@ -52,6 +53,8 @@
 #include "ios/chrome/browser/translate/translate_ranker_factory.h"
 #include "ios/chrome/browser/ui/browser_list/browser_list_factory.h"
 #include "ios/chrome/browser/ui/browser_list/browser_list_session_service_factory.h"
+#include "ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.h"
+#include "ios/chrome/browser/ui/fullscreen/fullscreen_features.h"
 #include "ios/chrome/browser/undo/bookmark_undo_service_factory.h"
 #include "ios/chrome/browser/web_data_service_factory.h"
 
@@ -119,4 +122,7 @@
   TabRestoreServiceDelegateImplIOSFactory::GetInstance();
   TranslateAcceptLanguagesFactory::GetInstance();
   UrlLanguageHistogramFactory::GetInstance();
+  if (base::FeatureList::IsEnabled(fullscreen::features::kNewFullscreen)) {
+    FullscreenControllerFactory::GetInstance();
+  }
 }
diff --git a/ios/chrome/browser/payments/payment_request.h b/ios/chrome/browser/payments/payment_request.h
index 177eb7b7..d4c312e8 100644
--- a/ios/chrome/browser/payments/payment_request.h
+++ b/ios/chrome/browser/payments/payment_request.h
@@ -381,11 +381,9 @@
   // created this PaymentRequest object.
   __weak id<PaymentRequestUIDelegate> payment_request_ui_delegate_;
 
-  // The address normalizer to use for the duration of the Payment Request.
-  autofill::AddressNormalizerImpl address_normalizer_;
-
   // Used to normalize the shipping address and the contact info.
-  autofill::AddressNormalizationManager address_normalization_manager_;
+  std::unique_ptr<autofill::AddressNormalizationManager>
+      address_normalization_manager_;
 
   // The currency formatter instance for this PaymentRequest flow.
   std::unique_ptr<CurrencyFormatter> currency_formatter_;
diff --git a/ios/chrome/browser/payments/payment_request.mm b/ios/chrome/browser/payments/payment_request.mm
index a34ccd8..42c09b9 100644
--- a/ios/chrome/browser/payments/payment_request.mm
+++ b/ios/chrome/browser/payments/payment_request.mm
@@ -28,6 +28,7 @@
 #include "components/prefs/pref_service.h"
 #include "components/signin/core/browser/signin_manager.h"
 #include "ios/chrome/browser/application_context.h"
+#include "ios/chrome/browser/autofill/address_normalizer_factory.h"
 #include "ios/chrome/browser/autofill/validation_rules_storage_factory.h"
 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
 #import "ios/chrome/browser/payments/ios_payment_instrument.h"
@@ -89,15 +90,6 @@
       web_state_(web_state),
       personal_data_manager_(personal_data_manager),
       payment_request_ui_delegate_(payment_request_ui_delegate),
-      // TODO(crbug.com/788229): Use a factory for the AddressNormalizer.
-      address_normalizer_(
-          GetAddressInputSource(
-              GetApplicationContext()->GetSystemURLRequestContext()),
-          GetAddressInputStorage(),
-          GetApplicationContext()->GetApplicationLocale()),
-      address_normalization_manager_(
-          &address_normalizer_,
-          GetApplicationContext()->GetApplicationLocale()),
       selected_shipping_profile_(nullptr),
       selected_contact_profile_(nullptr),
       selected_payment_method_(nullptr),
@@ -179,7 +171,7 @@
 }
 
 autofill::AddressNormalizer* PaymentRequest::GetAddressNormalizer() {
-  return &address_normalizer_;
+  return autofill::AddressNormalizerFactory::GetInstance();
 }
 
 autofill::RegionDataLoader* PaymentRequest::GetRegionDataLoader() {
@@ -281,7 +273,13 @@
 
 autofill::AddressNormalizationManager*
 PaymentRequest::GetAddressNormalizationManager() {
-  return &address_normalization_manager_;
+  if (!address_normalization_manager_) {
+    address_normalization_manager_ =
+        std::make_unique<autofill::AddressNormalizationManager>(
+            GetAddressNormalizer(),
+            GetApplicationContext()->GetApplicationLocale());
+  }
+  return address_normalization_manager_.get();
 }
 
 autofill::AutofillProfile* PaymentRequest::AddAutofillProfile(
diff --git a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
index 78d8d7d8..8e19c92e 100644
--- a/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
+++ b/ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.mm
@@ -7,12 +7,14 @@
 #include <utility>
 
 #include "base/bind.h"
+#include "base/feature_list.h"
 #include "base/memory/ptr_util.h"
 #include "components/autofill/core/browser/autofill_credit_card_filling_infobar_delegate_mobile.h"
 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_mobile.h"
 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h"
 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h"
 #include "components/autofill/core/browser/webdata/autofill_webdata_service.h"
+#include "components/autofill/core/common/autofill_features.h"
 #include "components/autofill/core/common/autofill_pref_names.h"
 #include "components/infobars/core/infobar.h"
 #include "components/infobars/core/infobar_manager.h"
@@ -21,6 +23,7 @@
 #include "components/prefs/pref_service.h"
 #include "google_apis/gaia/identity_provider.h"
 #include "ios/chrome/browser/application_context.h"
+#include "ios/chrome/browser/autofill/address_normalizer_factory.h"
 #include "ios/chrome/browser/autofill/personal_data_manager_factory.h"
 #include "ios/chrome/browser/browser_state/chrome_browser_state.h"
 #include "ios/chrome/browser/infobars/infobar_utils.h"
@@ -65,7 +68,8 @@
 }
 
 AddressNormalizer* ChromeAutofillClientIOS::GetAddressNormalizer() {
-  // TODO(crbug.com/788229): Supply an AddressNormalizer instance.
+  if (base::FeatureList::IsEnabled(features::kAutofillAddressNormalizer))
+    return AddressNormalizerFactory::GetInstance();
   return nullptr;
 }
 
diff --git a/ios/chrome/browser/ui/fullscreen/BUILD.gn b/ios/chrome/browser/ui/fullscreen/BUILD.gn
index 6a857373..37ed714 100644
--- a/ios/chrome/browser/ui/fullscreen/BUILD.gn
+++ b/ios/chrome/browser/ui/fullscreen/BUILD.gn
@@ -18,6 +18,7 @@
 source_set("new_fullscreen") {
   sources = [
     "fullscreen_controller.h",
+    "fullscreen_controller_factory.h",
     "fullscreen_controller_observer.h",
     "fullscreen_ui_updater.h",
     "scoped_fullscreen_disabler.h",
@@ -31,6 +32,8 @@
     ":new_fullscreen_internal",
     ":new_fullscreen_ui",
     "//base",
+    "//components/keyed_service/core",
+    "//components/keyed_service/ios",
     "//ios/chrome/browser/ui/browser_list",
     "//ios/chrome/browser/web_state_list",
   ]
@@ -39,6 +42,7 @@
 source_set("new_fullscreen_internal") {
   sources = [
     "fullscreen_controller.mm",
+    "fullscreen_controller_factory.mm",
     "fullscreen_model.h",
     "fullscreen_model.mm",
     "fullscreen_model_observer.h",
@@ -52,8 +56,11 @@
   configs += [ "//build/config/compiler:enable_arc" ]
 
   deps = [
+    ":fullscreen",
     ":new_fullscreen_ui",
     "//base",
+    "//components/keyed_service/ios",
+    "//ios/chrome/browser/browser_state",
     "//ios/chrome/browser/ui:ui_util",
     "//ios/chrome/browser/ui/broadcaster",
     "//ios/chrome/browser/ui/browser_list",
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_controller.h b/ios/chrome/browser/ui/fullscreen/fullscreen_controller.h
index f899dc9..8e62828 100644
--- a/ios/chrome/browser/ui/fullscreen/fullscreen_controller.h
+++ b/ios/chrome/browser/ui/fullscreen/fullscreen_controller.h
@@ -9,7 +9,7 @@
 #include <memory>
 
 #include "base/macros.h"
-#include "base/supports_user_data.h"
+#include "components/keyed_service/core/keyed_service.h"
 
 @class ChromeBroadcaster;
 @class ChromeBroadcastOberverBridge;
@@ -21,15 +21,11 @@
 // calculates how much of the toolbar should be visible as a result.  When the
 // user scrolls down the screen, the toolbar should be hidden to allow more of
 // the page's content to be visible.
-class FullscreenController : public base::SupportsUserData::Data {
+class FullscreenController : public KeyedService {
  public:
+  explicit FullscreenController();
   ~FullscreenController() override;
 
-  // Creation and getter functions for FullscreenController.
-  // TODO(crbug.com/790886): Convert FullscreenController to a BrowserUserData.
-  static void CreateForUserData(base::SupportsUserData* user_data);
-  static FullscreenController* FromUserData(base::SupportsUserData* user_data);
-
   // The ChromeBroadcaster through the FullscreenController receives UI
   // information necessary to calculate fullscreen progress.
   // TODO(crbug.com/790886): Once FullscreenController is a BrowserUserData,
@@ -54,8 +50,8 @@
   void DecrementDisabledCounter();
 
  private:
-  // Private contructor used by CreateForUserData().
-  explicit FullscreenController();
+  // KeyedService:
+  void Shutdown() override;
 
   // The broadcaster that drives the model.
   __strong ChromeBroadcaster* broadcaster_ = nil;
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_controller.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_controller.mm
index 869cd86d..aad947cc 100644
--- a/ios/chrome/browser/ui/fullscreen/fullscreen_controller.mm
+++ b/ios/chrome/browser/ui/fullscreen/fullscreen_controller.mm
@@ -14,29 +14,6 @@
 #error "This file requires ARC support."
 #endif
 
-namespace {
-// The key under which FullscreenControllers are associated with their user
-// data.
-const void* const kFullscreenControllerKey = &kFullscreenControllerKey;
-}  // namespace
-
-// static
-void FullscreenController::CreateForUserData(
-    base::SupportsUserData* user_data) {
-  DCHECK(user_data);
-  if (!FullscreenController::FromUserData(user_data)) {
-    user_data->SetUserData(kFullscreenControllerKey,
-                           base::WrapUnique(new FullscreenController()));
-  }
-}
-
-// static
-FullscreenController* FullscreenController::FromUserData(
-    base::SupportsUserData* user_data) {
-  return static_cast<FullscreenController*>(
-      user_data->GetUserData(kFullscreenControllerKey));
-}
-
 FullscreenController::FullscreenController()
     : broadcaster_([[ChromeBroadcaster alloc] init]),
       model_(base::MakeUnique<FullscreenModel>()),
@@ -53,16 +30,7 @@
                 forSelector:@selector(broadcastToolbarHeight:)];
 }
 
-FullscreenController::~FullscreenController() {
-  [broadcaster_ removeObserver:bridge_
-                   forSelector:@selector(broadcastContentScrollOffset:)];
-  [broadcaster_ removeObserver:bridge_
-                   forSelector:@selector(broadcastScrollViewIsScrolling:)];
-  [broadcaster_ removeObserver:bridge_
-                   forSelector:@selector(broadcastScrollViewIsDragging:)];
-  [broadcaster_ removeObserver:bridge_
-                   forSelector:@selector(broadcastToolbarHeight:)];
-}
+FullscreenController::~FullscreenController() = default;
 
 void FullscreenController::AddObserver(FullscreenControllerObserver* observer) {
   // TODO(crbug.com/785671): Use FullscreenControllerObserverManager to keep
@@ -86,3 +54,14 @@
 void FullscreenController::DecrementDisabledCounter() {
   model_->DecrementDisabledCounter();
 }
+
+void FullscreenController::Shutdown() {
+  [broadcaster_ removeObserver:bridge_
+                   forSelector:@selector(broadcastContentScrollOffset:)];
+  [broadcaster_ removeObserver:bridge_
+                   forSelector:@selector(broadcastScrollViewIsScrolling:)];
+  [broadcaster_ removeObserver:bridge_
+                   forSelector:@selector(broadcastScrollViewIsDragging:)];
+  [broadcaster_ removeObserver:bridge_
+                   forSelector:@selector(broadcastToolbarHeight:)];
+}
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.h b/ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.h
new file mode 100644
index 0000000..6c3b8e70
--- /dev/null
+++ b/ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.h
@@ -0,0 +1,47 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_FACTORY_H_
+#define IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_FACTORY_H_
+
+#include "base/macros.h"
+#include "components/keyed_service/ios/browser_state_keyed_service_factory.h"
+
+namespace base {
+template <typename T>
+struct DefaultSingletonTraits;
+}
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+class FullscreenController;
+
+// FullscreenControllerFactory attaches FullscreenControllers to
+// ChromeBrowserStates.
+class FullscreenControllerFactory : public BrowserStateKeyedServiceFactory {
+ public:
+  // Convenience getter that typecasts the value returned to a
+  // FullscreenController.
+  static FullscreenController* GetForBrowserState(
+      ios::ChromeBrowserState* browser_state);
+  // Getter for singleton instance.
+  static FullscreenControllerFactory* GetInstance();
+
+ private:
+  friend struct base::DefaultSingletonTraits<FullscreenControllerFactory>;
+
+  FullscreenControllerFactory();
+
+  // BrowserStateKeyedServiceFactory:
+  std::unique_ptr<KeyedService> BuildServiceInstanceFor(
+      web::BrowserState* context) const override;
+  web::BrowserState* GetBrowserStateToUse(
+      web::BrowserState* context) const override;
+
+  DISALLOW_COPY_AND_ASSIGN(FullscreenControllerFactory);
+};
+
+#endif  // IOS_CHROME_BROWSER_UI_FULLSCREEN_FULLSCREEN_CONTROLLER_FACTORY_H_
diff --git a/ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.mm b/ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.mm
new file mode 100644
index 0000000..f16bdf0
--- /dev/null
+++ b/ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.mm
@@ -0,0 +1,46 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/chrome/browser/ui/fullscreen/fullscreen_controller_factory.h"
+
+#include <memory>
+
+#include "base/memory/ptr_util.h"
+#include "base/memory/singleton.h"
+#include "components/keyed_service/ios/browser_state_dependency_manager.h"
+#include "ios/chrome/browser/browser_state/browser_state_otr_helper.h"
+#include "ios/chrome/browser/browser_state/chrome_browser_state.h"
+#import "ios/chrome/browser/ui/fullscreen/fullscreen_controller.h"
+
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
+// static
+FullscreenController* FullscreenControllerFactory::GetForBrowserState(
+    ios::ChromeBrowserState* browser_state) {
+  return static_cast<FullscreenController*>(
+      GetInstance()->GetServiceForBrowserState(browser_state, true));
+}
+
+// static
+FullscreenControllerFactory* FullscreenControllerFactory::GetInstance() {
+  return base::Singleton<FullscreenControllerFactory>::get();
+}
+
+FullscreenControllerFactory::FullscreenControllerFactory()
+    : BrowserStateKeyedServiceFactory(
+          "FullscreenController",
+          BrowserStateDependencyManager::GetInstance()) {}
+
+std::unique_ptr<KeyedService>
+FullscreenControllerFactory::BuildServiceInstanceFor(
+    web::BrowserState* context) const {
+  return base::MakeUnique<FullscreenController>();
+}
+
+web::BrowserState* FullscreenControllerFactory::GetBrowserStateToUse(
+    web::BrowserState* context) const {
+  return GetBrowserStateOwnInstanceInIncognito(context);
+}
diff --git a/ios/chrome/browser/ui/toolbar/legacy_toolbar_coordinator.mm b/ios/chrome/browser/ui/toolbar/legacy_toolbar_coordinator.mm
index 120c0484..70c978e 100644
--- a/ios/chrome/browser/ui/toolbar/legacy_toolbar_coordinator.mm
+++ b/ios/chrome/browser/ui/toolbar/legacy_toolbar_coordinator.mm
@@ -213,12 +213,6 @@
 
 - (UIView*)snapshotForStackViewWithWidth:(CGFloat)width
                           safeAreaInsets:(UIEdgeInsets)safeAreaInsets {
-  // The snapshotted view must not be in the view hierarchy, because the code
-  // below temporarily changes the frames of views in order to take the snapshot
-  // in simulated target frame. The frames will be returned to normal after the
-  // snapshot is taken.
-  DCHECK(self.toolbarViewController.view.window == nil);
-
   CGRect oldFrame = self.toolbarViewController.view.superview.frame;
   CGRect newFrame = oldFrame;
   newFrame.size.width = width;
diff --git a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2 b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2
index ea641a7..583b0f17 100644
--- a/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2
+++ b/third_party/WebKit/LayoutTests/FlagExpectations/enable-slimming-paint-v2
@@ -1040,6 +1040,7 @@
 Bug(none) compositing/composited-translated-child-with-border-radius-parent-clip.html [ Failure ]
 Bug(none) compositing/overflow/border-radius-on-grandparent-composited-grandchild.html [ Failure ]
 Bug(none) compositing/overflow/border-radius-on-two-ancestors-composited-grandchild.html [ Failure ]
+Bug(none) compositing/overflow/border-radius-on-squashed-layers.html [ Failure ]
 Bug(none) compositing/overflow/border-radius-styles-with-composited-child.html [ Failure ]
 Bug(none) compositing/overflow/grandchild-composited-with-border-radius-ancestor.html [ Failure ]
 Bug(none) compositing/overflow/grandchild-with-border-radius-ancestor.html [ Failure ]
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers-expected.png b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers-expected.png
new file mode 100644
index 0000000..f1276ed01
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers-expected.png
Binary files differ
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers-expected.txt b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers-expected.txt
new file mode 100644
index 0000000..c4f73f9
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers-expected.txt
@@ -0,0 +1,11 @@
+layer at (0,0) size 800x600
+  LayoutView at (0,0) size 800x600
+layer at (0,0) size 800x98
+  LayoutBlockFlow {HTML} at (0,0) size 800x98
+    LayoutBlockFlow {BODY} at (8,8) size 784x82
+layer at (8,8) size 100x40
+  LayoutBlockFlow {DIV} at (0,0) size 100x40 [bgcolor=#0000FF]
+layer at (8,3) size 102x42 clip at (9,4) size 100x40 scrollWidth 190 scrollHeight 200
+  LayoutBlockFlow (relative positioned) {DIV} at (0,40) size 102x42 [bgcolor=#FF0000] [border: (1px solid #000000)]
+layer at (-1,-6) size 200x200 backgroundClip at (9,4) size 100x40 clip at (9,4) size 100x40
+  LayoutBlockFlow (relative positioned) {DIV} at (1,1) size 200x200 [bgcolor=#008000]
diff --git a/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers.html b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers.html
new file mode 100644
index 0000000..ea05f22
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/compositing/overflow/border-radius-on-squashed-layers.html
@@ -0,0 +1,33 @@
+<!DOCTYPE html>
+<style>
+.precursor {
+  width: 100px;
+  height: 40px;
+  background-color: blue;
+  will-change: transform;
+}
+.container {
+  position: relative;
+  top: -45px;
+  width: 100px;
+  height: 40px;
+  background-color: red;
+  border: 1px solid black;
+  border-radius: 10px;
+  overflow: hidden;
+}
+
+.contents {
+  background-color: green;
+  height: 200px;
+  width: 200px;
+  position: relative;
+  top: -10px;
+  left: -10px;
+}
+</style>
+<div class="precursor"></div>
+<div class="container">
+  <div class="contents"></div>
+</div>
+
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc b/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc
index 91b2a9a..9a7d835 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.cc
@@ -179,4 +179,20 @@
   oof_positioned_candidates_.clear();
 }
 
+#ifndef NDEBUG
+
+String NGContainerFragmentBuilder::ToString() const {
+  StringBuilder builder;
+  builder.Append(String::Format("ContainerFragment %.2fx%.2f, Children %zu\n",
+                                inline_size_.ToFloat(), block_size_.ToFloat(),
+                                children_.size()));
+  for (auto& child : children_) {
+    builder.Append(child->DumpFragmentTree(
+        NGPhysicalFragment::DumpAll & ~NGPhysicalFragment::DumpHeaderText));
+  }
+  return builder.ToString();
+}
+
+#endif
+
 }  // namespace blink
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.h b/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.h
index 12941bd..c7114e2 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_container_fragment_builder.h
@@ -106,6 +106,10 @@
   void GetAndClearOutOfFlowDescendantCandidates(
       Vector<NGOutOfFlowPositionedDescendant>* descendant_candidates);
 
+#ifndef NDEBUG
+  String ToString() const;
+#endif
+
  protected:
   // An out-of-flow positioned-candidate is a temporary data structure used
   // within the NGFragmentBuilder.
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc
index 5ce34c7..04a6022a 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc
+++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.cc
@@ -277,15 +277,17 @@
 String NGPhysicalFragment::ToString() const {
   return String::Format(
       "Type: '%d' Size: '%s' Offset: '%s' Placed: '%d', BoxType: '%s'", Type(),
-      Size().ToString().Ascii().data(), Offset().ToString().Ascii().data(),
-      IsPlaced(), StringForBoxType(BoxType()).Ascii().data());
+      Size().ToString().Ascii().data(),
+      is_placed_ ? Offset().ToString().Ascii().data() : "no offset", IsPlaced(),
+      StringForBoxType(BoxType()).Ascii().data());
 }
 
-String NGPhysicalFragment::DumpFragmentTree(DumpFlags flags) const {
+String NGPhysicalFragment::DumpFragmentTree(DumpFlags flags,
+                                            unsigned indent) const {
   StringBuilder string_builder;
   if (flags & DumpHeaderText)
     string_builder.Append(".:: LayoutNG Physical Fragment Tree ::.\n");
-  AppendFragmentToString(this, &string_builder, flags);
+  AppendFragmentToString(this, &string_builder, flags, indent);
   return string_builder.ToString();
 }
 
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
index 007746b..39770bf 100644
--- a/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
+++ b/third_party/WebKit/Source/core/layout/ng/ng_physical_fragment.h
@@ -157,7 +157,7 @@
   };
   typedef int DumpFlags;
 
-  String DumpFragmentTree(DumpFlags) const;
+  String DumpFragmentTree(DumpFlags, unsigned indent = 2) const;
 
 #ifndef NDEBUG
   void ShowFragmentTree() const;
diff --git a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
index aa9626d..cbeb5f2 100644
--- a/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/DocumentThreadableLoader.cpp
@@ -622,7 +622,7 @@
     const ResourceRequest& new_request,
     const ResourceResponse& redirect_response) {
   DCHECK(client_);
-  DCHECK_EQ(resource, this->GetResource());
+  DCHECK_EQ(resource, GetResource());
   DCHECK(async_);
 
   suborigin_force_credentials_ = false;
@@ -797,7 +797,7 @@
     unsigned long long bytes_sent,
     unsigned long long total_bytes_to_be_sent) {
   DCHECK(client_);
-  DCHECK_EQ(resource, this->GetResource());
+  DCHECK_EQ(resource, GetResource());
   DCHECK(async_);
 
   checker_.DataSent();
@@ -807,7 +807,7 @@
 void DocumentThreadableLoader::DataDownloaded(Resource* resource,
                                               int data_length) {
   DCHECK(client_);
-  DCHECK_EQ(resource, this->GetResource());
+  DCHECK_EQ(resource, GetResource());
   DCHECK(actual_request_.IsNull());
   DCHECK(async_);
 
@@ -819,7 +819,7 @@
     Resource* resource,
     const ResourceTimingInfo& info) {
   DCHECK(client_);
-  DCHECK_EQ(resource, this->GetResource());
+  DCHECK_EQ(resource, GetResource());
   DCHECK(async_);
 
   client_->DidReceiveResourceTiming(info);
@@ -829,7 +829,7 @@
     Resource* resource,
     const ResourceResponse& response,
     std::unique_ptr<WebDataConsumerHandle> handle) {
-  DCHECK_EQ(resource, this->GetResource());
+  DCHECK_EQ(resource, GetResource());
   DCHECK(async_);
 
   checker_.ResponseReceived();
@@ -1032,7 +1032,7 @@
 void DocumentThreadableLoader::DataReceived(Resource* resource,
                                             const char* data,
                                             size_t data_length) {
-  DCHECK_EQ(resource, this->GetResource());
+  DCHECK_EQ(resource, GetResource());
   DCHECK(async_);
 
   checker_.DataReceived();
@@ -1060,7 +1060,7 @@
 
 void DocumentThreadableLoader::NotifyFinished(Resource* resource) {
   DCHECK(client_);
-  DCHECK_EQ(resource, this->GetResource());
+  DCHECK_EQ(resource, GetResource());
   DCHECK(async_);
 
   checker_.NotifyFinished(resource);
diff --git a/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp b/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
index 5c6fb111..8813cfc 100644
--- a/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/TextTrackLoader.cpp
@@ -69,7 +69,7 @@
 bool TextTrackLoader::RedirectReceived(Resource* resource,
                                        const ResourceRequest& request,
                                        const ResourceResponse&) {
-  DCHECK_EQ(this->GetResource(), resource);
+  DCHECK_EQ(GetResource(), resource);
   if (resource->GetResourceRequest().GetFetchRequestMode() ==
           network::mojom::FetchRequestMode::kCORS ||
       GetDocument().GetSecurityOrigin()->CanRequestNoSuborigin(request.Url()))
@@ -85,7 +85,7 @@
 void TextTrackLoader::DataReceived(Resource* resource,
                                    const char* data,
                                    size_t length) {
-  DCHECK_EQ(this->GetResource(), resource);
+  DCHECK_EQ(GetResource(), resource);
 
   if (state_ == kFailed)
     return;
@@ -110,7 +110,7 @@
 }
 
 void TextTrackLoader::NotifyFinished(Resource* resource) {
-  DCHECK_EQ(this->GetResource(), resource);
+  DCHECK_EQ(GetResource(), resource);
   if (cue_parser_)
     cue_parser_->Flush();
 
diff --git a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
index 111a3785..ce5fcb10 100644
--- a/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/loader/resource/ImageResource.cpp
@@ -329,7 +329,7 @@
 
     // Update the image immediately if needed.
     if (GetContent()->ShouldUpdateImageImmediately()) {
-      UpdateImage(this->Data(), ImageResourceContent::kUpdateImage, false);
+      UpdateImage(Data(), ImageResourceContent::kUpdateImage, false);
       return;
     }
 
@@ -357,7 +357,7 @@
   // to call |updateImage()|.
   if (IsLoading()) {
     last_flush_time_ = WTF::MonotonicallyIncreasingTime();
-    UpdateImage(this->Data(), ImageResourceContent::kUpdateImage, false);
+    UpdateImage(Data(), ImageResourceContent::kUpdateImage, false);
   }
 }
 
diff --git a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp
index 922e75a8..a5babf72 100644
--- a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp
+++ b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.cpp
@@ -1117,8 +1117,7 @@
       squash_layer_origin_in_compositing_container_space);
 
   for (size_t i = 0; i < layers.size(); ++i) {
-    layers[i].local_clip_rect_for_squashed_layer =
-        LocalClipRectForSquashedLayer(owning_layer_, layers[i], layers);
+    LocalClipRectForSquashedLayer(owning_layer_, layers, layers[i]);
   }
 }
 
@@ -3118,14 +3117,19 @@
       layout_object, squashed_layers_, max_squashed_layer_index);
 }
 
-IntRect CompositedLayerMapping::LocalClipRectForSquashedLayer(
+void CompositedLayerMapping::LocalClipRectForSquashedLayer(
     const PaintLayer& reference_layer,
-    const GraphicsLayerPaintInfo& paint_info,
-    const Vector<GraphicsLayerPaintInfo>& layers) {
+    const Vector<GraphicsLayerPaintInfo>& layers,
+    GraphicsLayerPaintInfo& paint_info) {
   const LayoutObject* clipping_container =
       paint_info.paint_layer->ClippingContainer();
-  if (clipping_container == reference_layer.ClippingContainer())
-    return LayoutRect::InfiniteIntRect();
+  if (clipping_container == reference_layer.ClippingContainer()) {
+    paint_info.local_clip_rect_for_squashed_layer =
+        ClipRect(LayoutRect(LayoutRect::InfiniteIntRect()));
+    paint_info.offset_from_clip_rect_root = LayoutPoint();
+    paint_info.local_clip_rect_root = paint_info.paint_layer;
+    return;
+  }
 
   DCHECK(clipping_container);
 
@@ -3144,16 +3148,15 @@
   paint_info.paint_layer->Clipper(PaintLayer::kDoNotUseGeometryMapper)
       .CalculateBackgroundClipRect(clip_rects_context, parent_clip_rect);
 
-  IntRect snapped_parent_clip_rect(
-      PixelSnappedIntRect(parent_clip_rect.Rect()));
-  DCHECK(snapped_parent_clip_rect != LayoutRect::InfiniteIntRect());
-
   // Convert from ancestor to local coordinates.
   IntSize ancestor_to_local_offset =
       paint_info.offset_from_layout_object -
       ancestor_paint_info->offset_from_layout_object;
-  snapped_parent_clip_rect.Move(ancestor_to_local_offset);
-  return snapped_parent_clip_rect;
+  parent_clip_rect.Move(ancestor_to_local_offset);
+  paint_info.local_clip_rect_for_squashed_layer = parent_clip_rect;
+  paint_info.offset_from_clip_rect_root = LayoutPoint(
+      ancestor_to_local_offset.Width(), ancestor_to_local_offset.Height());
+  paint_info.local_clip_rect_root = ancestor_paint_info->paint_layer;
 }
 
 void CompositedLayerMapping::DoPaintTask(
@@ -3227,11 +3230,15 @@
     // squash layers that need clipping in software from clipping ancestors (see
     // CompositedLayerMapping::localClipRectForSquashedLayer()).
     // FIXME: Is it correct to clip to dirtyRect in slimming paint mode?
-    // FIXME: Combine similar code here and LayerClipRecorder.
-    dirty_rect.Intersect(paint_info.local_clip_rect_for_squashed_layer);
-    ClipRecorder clip_recorder(context, graphics_layer,
-                               DisplayItem::kClipLayerOverflowControls,
-                               dirty_rect);
+    ClipRect clip_rect = paint_info.local_clip_rect_for_squashed_layer;
+    clip_rect.Intersect(LayoutRect(dirty_rect));
+
+    LayerClipRecorder layer_clip_recorder(
+        context, *paint_info.paint_layer,
+        DisplayItem::kClipLayerOverflowControls, clip_rect,
+        paint_info.local_clip_rect_root, paint_info.offset_from_clip_rect_root,
+        paint_layer_flags, graphics_layer,
+        LayerClipRecorder::kDoNotIncludeSelfForBorderRadius);
     PaintLayerPainter(*paint_info.paint_layer)
         .Paint(context, painting_info, paint_layer_flags);
   }
diff --git a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.h b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.h
index 7ee70d9..636c9cea 100644
--- a/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.h
+++ b/third_party/WebKit/Source/core/paint/compositing/CompositedLayerMapping.h
@@ -50,7 +50,9 @@
 
   // The clip rect to apply, in the local coordinate space of the squashed
   // layer, when painting it.
-  IntRect local_clip_rect_for_squashed_layer;
+  ClipRect local_clip_rect_for_squashed_layer;
+  PaintLayer* local_clip_rect_root;
+  LayoutPoint offset_from_clip_rect_root;
 
   // Offset describing where this squashed Layer paints into the shared
   // GraphicsLayer backing.
@@ -484,10 +486,10 @@
   // no such containing layer, returns the infinite rect.
   // FIXME: unify this code with the code that sets up ancestor_clipping_layer_.
   // They are doing very similar things.
-  static IntRect LocalClipRectForSquashedLayer(
+  static void LocalClipRectForSquashedLayer(
       const PaintLayer& reference_layer,
-      const GraphicsLayerPaintInfo&,
-      const Vector<GraphicsLayerPaintInfo>& layers);
+      const Vector<GraphicsLayerPaintInfo>& layers,
+      GraphicsLayerPaintInfo&);
 
   // Conservatively check whether there exists any border-radius clip that
   // must be applied by an ancestor clipping mask layer. There are two inputs
diff --git a/third_party/libaom/BUILD.gn b/third_party/libaom/BUILD.gn
index 8f69fcde..205746aa 100644
--- a/third_party/libaom/BUILD.gn
+++ b/third_party/libaom/BUILD.gn
@@ -22,6 +22,8 @@
     cpu_arch_full = "ia32"
   } else if (current_cpu == "x64") {
     if (is_msan) {
+      # TODO(johannkoenig): Check if MSAN builds pass. libaom is favoring
+      # intrinsics over assembly.
       cpu_arch_full = "generic"
     } else {
       cpu_arch_full = "x64"
@@ -39,7 +41,7 @@
   }
 
   if (is_nacl) {
-    platform_include_dir = "source/config/nacl"
+    platform_include_dir = "source/config/linux/generic"
   } else {
     # TODO(johannkoenig): remove mac-specific config files.
     # The mac configurations are currently a relic. They were useful when
diff --git a/third_party/libaom/generate_gni.sh b/third_party/libaom/generate_gni.sh
index ff2145d9..f5acabd 100755
--- a/third_party/libaom/generate_gni.sh
+++ b/third_party/libaom/generate_gni.sh
@@ -321,7 +321,7 @@
 #gen_config_files linux/arm64 "--target=armv8-linux-gcc ${all_platforms}"
 #gen_config_files linux/mipsel "--target=mips32-linux-gcc ${all_platforms}"
 #gen_config_files linux/mips64el "--target=mips64-linux-gcc ${all_platforms}"
-#gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
+gen_config_files linux/generic "--target=generic-gnu $HIGHBD ${all_platforms}"
 gen_config_files win/ia32 "--target=x86-win32-vs12 ${all_platforms} ${x86_platforms}"
 gen_config_files win/x64 "--target=x86_64-win64-vs12 ${all_platforms} ${x86_platforms}"
 #gen_config_files mac/ia32 "--target=x86-darwin9-gcc ${all_platforms} ${x86_platforms}"
@@ -343,7 +343,7 @@
 #lint_config linux/arm64
 #lint_config linux/mipsel
 #lint_config linux/mips64el
-#lint_config linux/generic
+lint_config linux/generic
 lint_config win/ia32
 lint_config win/x64
 #lint_config mac/ia32
@@ -366,7 +366,7 @@
 #gen_rtcd_header linux/arm64 armv8
 #gen_rtcd_header linux/mipsel mipsel
 #gen_rtcd_header linux/mips64el mips64el
-#gen_rtcd_header linux/generic generic
+gen_rtcd_header linux/generic generic
 gen_rtcd_header win/ia32 x86
 gen_rtcd_header win/x64 x86_64
 #gen_rtcd_header mac/ia32 x86
@@ -436,12 +436,12 @@
 #  make_clean
 #  make libaom_srcs.txt target=libs $config > /dev/null
 #  convert_srcs_to_project_files libaom_srcs.txt libaom_srcs_nacl
-#
-#  echo "Generate GENERIC source list."
-#  config=$(print_config_basic linux/generic)
-#  make_clean
-#  make libaom_srcs.txt target=libs $config > /dev/null
-#  convert_srcs_to_project_files libaom_srcs.txt libaom_srcs_generic
+
+  echo "Generate GENERIC source list."
+  config=$(print_config_basic linux/generic)
+  make_clean
+  make libaom_srcs.txt target=libs $config > /dev/null
+  convert_srcs_to_project_files libaom_srcs.txt libaom_srcs_generic
 fi
 
 echo "Remove temporary directory."
diff --git a/third_party/libaom/libaom_srcs.gni b/third_party/libaom/libaom_srcs.gni
index ec8e59f..10b6abd 100644
--- a/third_party/libaom/libaom_srcs.gni
+++ b/third_party/libaom/libaom_srcs.gni
@@ -465,3 +465,171 @@
   "//third_party/libaom/source/libaom/av1/common/x86/highbd_inv_txfm_avx2.c",
   "//third_party/libaom/source/libaom/av1/common/x86/hybrid_inv_txfm_avx2.c",
 ]
+libaom_srcs_generic = [
+  "//third_party/libaom/source/libaom/aom/aom.h",
+  "//third_party/libaom/source/libaom/aom/aom_codec.h",
+  "//third_party/libaom/source/libaom/aom/aom_decoder.h",
+  "//third_party/libaom/source/libaom/aom/aom_encoder.h",
+  "//third_party/libaom/source/libaom/aom/aom_frame_buffer.h",
+  "//third_party/libaom/source/libaom/aom/aom_image.h",
+  "//third_party/libaom/source/libaom/aom/aom_integer.h",
+  "//third_party/libaom/source/libaom/aom/aomdx.h",
+  "//third_party/libaom/source/libaom/aom/internal/aom_codec_internal.h",
+  "//third_party/libaom/source/libaom/aom/src/aom_codec.c",
+  "//third_party/libaom/source/libaom/aom/src/aom_decoder.c",
+  "//third_party/libaom/source/libaom/aom/src/aom_encoder.c",
+  "//third_party/libaom/source/libaom/aom/src/aom_image.c",
+  "//third_party/libaom/source/libaom/aom_dsp/aom_convolve.c",
+  "//third_party/libaom/source/libaom/aom_dsp/aom_convolve.h",
+  "//third_party/libaom/source/libaom/aom_dsp/aom_dsp_common.h",
+  "//third_party/libaom/source/libaom/aom_dsp/aom_dsp_rtcd.c",
+  "//third_party/libaom/source/libaom/aom_dsp/aom_filter.h",
+  "//third_party/libaom/source/libaom/aom_dsp/aom_simd.h",
+  "//third_party/libaom/source/libaom/aom_dsp/aom_simd_inline.h",
+  "//third_party/libaom/source/libaom/aom_dsp/binary_codes_reader.c",
+  "//third_party/libaom/source/libaom/aom_dsp/binary_codes_reader.h",
+  "//third_party/libaom/source/libaom/aom_dsp/bitreader.h",
+  "//third_party/libaom/source/libaom/aom_dsp/bitreader_buffer.c",
+  "//third_party/libaom/source/libaom/aom_dsp/bitreader_buffer.h",
+  "//third_party/libaom/source/libaom/aom_dsp/blend.h",
+  "//third_party/libaom/source/libaom/aom_dsp/blend_a64_hmask.c",
+  "//third_party/libaom/source/libaom/aom_dsp/blend_a64_mask.c",
+  "//third_party/libaom/source/libaom/aom_dsp/blend_a64_vmask.c",
+  "//third_party/libaom/source/libaom/aom_dsp/daalaboolreader.c",
+  "//third_party/libaom/source/libaom/aom_dsp/daalaboolreader.h",
+  "//third_party/libaom/source/libaom/aom_dsp/entcode.c",
+  "//third_party/libaom/source/libaom/aom_dsp/entcode.h",
+  "//third_party/libaom/source/libaom/aom_dsp/entdec.c",
+  "//third_party/libaom/source/libaom/aom_dsp/entdec.h",
+  "//third_party/libaom/source/libaom/aom_dsp/intrapred.c",
+  "//third_party/libaom/source/libaom/aom_dsp/inv_txfm.c",
+  "//third_party/libaom/source/libaom/aom_dsp/inv_txfm.h",
+  "//third_party/libaom/source/libaom/aom_dsp/loopfilter.c",
+  "//third_party/libaom/source/libaom/aom_dsp/prob.c",
+  "//third_party/libaom/source/libaom/aom_dsp/prob.h",
+  "//third_party/libaom/source/libaom/aom_dsp/simd/v128_intrinsics.h",
+  "//third_party/libaom/source/libaom/aom_dsp/simd/v128_intrinsics_c.h",
+  "//third_party/libaom/source/libaom/aom_dsp/simd/v256_intrinsics.h",
+  "//third_party/libaom/source/libaom/aom_dsp/simd/v256_intrinsics_c.h",
+  "//third_party/libaom/source/libaom/aom_dsp/simd/v256_intrinsics_v128.h",
+  "//third_party/libaom/source/libaom/aom_dsp/simd/v64_intrinsics.h",
+  "//third_party/libaom/source/libaom/aom_dsp/simd/v64_intrinsics_c.h",
+  "//third_party/libaom/source/libaom/aom_dsp/txfm_common.h",
+  "//third_party/libaom/source/libaom/aom_dsp/x86/txfm_common_intrin.h",
+  "//third_party/libaom/source/libaom/aom_mem/aom_mem.c",
+  "//third_party/libaom/source/libaom/aom_mem/aom_mem.h",
+  "//third_party/libaom/source/libaom/aom_mem/include/aom_mem_intrnl.h",
+  "//third_party/libaom/source/libaom/aom_ports/aom_once.h",
+  "//third_party/libaom/source/libaom/aom_ports/aom_timer.h",
+  "//third_party/libaom/source/libaom/aom_ports/bitops.h",
+  "//third_party/libaom/source/libaom/aom_ports/emmintrin_compat.h",
+  "//third_party/libaom/source/libaom/aom_ports/mem.h",
+  "//third_party/libaom/source/libaom/aom_ports/mem_ops.h",
+  "//third_party/libaom/source/libaom/aom_ports/mem_ops_aligned.h",
+  "//third_party/libaom/source/libaom/aom_ports/msvc.h",
+  "//third_party/libaom/source/libaom/aom_ports/system_state.h",
+  "//third_party/libaom/source/libaom/aom_scale/aom_scale.h",
+  "//third_party/libaom/source/libaom/aom_scale/aom_scale_rtcd.c",
+  "//third_party/libaom/source/libaom/aom_scale/generic/aom_scale.c",
+  "//third_party/libaom/source/libaom/aom_scale/generic/gen_scalers.c",
+  "//third_party/libaom/source/libaom/aom_scale/generic/yv12config.c",
+  "//third_party/libaom/source/libaom/aom_scale/generic/yv12extend.c",
+  "//third_party/libaom/source/libaom/aom_scale/yv12config.h",
+  "//third_party/libaom/source/libaom/aom_util/aom_thread.c",
+  "//third_party/libaom/source/libaom/aom_util/aom_thread.h",
+  "//third_party/libaom/source/libaom/aom_util/endian_inl.h",
+  "//third_party/libaom/source/libaom/av1/av1_dx_iface.c",
+  "//third_party/libaom/source/libaom/av1/av1_iface_common.h",
+  "//third_party/libaom/source/libaom/av1/common/alloccommon.c",
+  "//third_party/libaom/source/libaom/av1/common/alloccommon.h",
+  "//third_party/libaom/source/libaom/av1/common/av1_fwd_txfm1d.c",
+  "//third_party/libaom/source/libaom/av1/common/av1_fwd_txfm1d.h",
+  "//third_party/libaom/source/libaom/av1/common/av1_fwd_txfm1d_cfg.h",
+  "//third_party/libaom/source/libaom/av1/common/av1_fwd_txfm2d.c",
+  "//third_party/libaom/source/libaom/av1/common/av1_inv_txfm1d.c",
+  "//third_party/libaom/source/libaom/av1/common/av1_inv_txfm1d.h",
+  "//third_party/libaom/source/libaom/av1/common/av1_inv_txfm1d_cfg.h",
+  "//third_party/libaom/source/libaom/av1/common/av1_inv_txfm2d.c",
+  "//third_party/libaom/source/libaom/av1/common/av1_loopfilter.c",
+  "//third_party/libaom/source/libaom/av1/common/av1_loopfilter.h",
+  "//third_party/libaom/source/libaom/av1/common/av1_rtcd.c",
+  "//third_party/libaom/source/libaom/av1/common/av1_txfm.h",
+  "//third_party/libaom/source/libaom/av1/common/blockd.c",
+  "//third_party/libaom/source/libaom/av1/common/blockd.h",
+  "//third_party/libaom/source/libaom/av1/common/cdef.c",
+  "//third_party/libaom/source/libaom/av1/common/cdef.h",
+  "//third_party/libaom/source/libaom/av1/common/cdef_block.c",
+  "//third_party/libaom/source/libaom/av1/common/cdef_block.h",
+  "//third_party/libaom/source/libaom/av1/common/cdef_block_simd.h",
+  "//third_party/libaom/source/libaom/av1/common/clpf.c",
+  "//third_party/libaom/source/libaom/av1/common/clpf_simd.h",
+  "//third_party/libaom/source/libaom/av1/common/common.h",
+  "//third_party/libaom/source/libaom/av1/common/common_data.h",
+  "//third_party/libaom/source/libaom/av1/common/convolve.c",
+  "//third_party/libaom/source/libaom/av1/common/convolve.h",
+  "//third_party/libaom/source/libaom/av1/common/daala_tx.c",
+  "//third_party/libaom/source/libaom/av1/common/daala_tx.h",
+  "//third_party/libaom/source/libaom/av1/common/debugmodes.c",
+  "//third_party/libaom/source/libaom/av1/common/entropy.c",
+  "//third_party/libaom/source/libaom/av1/common/entropy.h",
+  "//third_party/libaom/source/libaom/av1/common/entropymode.c",
+  "//third_party/libaom/source/libaom/av1/common/entropymode.h",
+  "//third_party/libaom/source/libaom/av1/common/entropymv.c",
+  "//third_party/libaom/source/libaom/av1/common/entropymv.h",
+  "//third_party/libaom/source/libaom/av1/common/enums.h",
+  "//third_party/libaom/source/libaom/av1/common/filter.c",
+  "//third_party/libaom/source/libaom/av1/common/filter.h",
+  "//third_party/libaom/source/libaom/av1/common/frame_buffers.c",
+  "//third_party/libaom/source/libaom/av1/common/frame_buffers.h",
+  "//third_party/libaom/source/libaom/av1/common/idct.c",
+  "//third_party/libaom/source/libaom/av1/common/idct.h",
+  "//third_party/libaom/source/libaom/av1/common/mv.h",
+  "//third_party/libaom/source/libaom/av1/common/mvref_common.c",
+  "//third_party/libaom/source/libaom/av1/common/mvref_common.h",
+  "//third_party/libaom/source/libaom/av1/common/obmc.h",
+  "//third_party/libaom/source/libaom/av1/common/odintrin.c",
+  "//third_party/libaom/source/libaom/av1/common/odintrin.h",
+  "//third_party/libaom/source/libaom/av1/common/onyxc_int.h",
+  "//third_party/libaom/source/libaom/av1/common/pred_common.c",
+  "//third_party/libaom/source/libaom/av1/common/pred_common.h",
+  "//third_party/libaom/source/libaom/av1/common/quant_common.c",
+  "//third_party/libaom/source/libaom/av1/common/quant_common.h",
+  "//third_party/libaom/source/libaom/av1/common/reconinter.c",
+  "//third_party/libaom/source/libaom/av1/common/reconinter.h",
+  "//third_party/libaom/source/libaom/av1/common/reconintra.c",
+  "//third_party/libaom/source/libaom/av1/common/reconintra.h",
+  "//third_party/libaom/source/libaom/av1/common/resize.c",
+  "//third_party/libaom/source/libaom/av1/common/resize.h",
+  "//third_party/libaom/source/libaom/av1/common/scale.c",
+  "//third_party/libaom/source/libaom/av1/common/scale.h",
+  "//third_party/libaom/source/libaom/av1/common/scan.c",
+  "//third_party/libaom/source/libaom/av1/common/scan.h",
+  "//third_party/libaom/source/libaom/av1/common/seg_common.c",
+  "//third_party/libaom/source/libaom/av1/common/seg_common.h",
+  "//third_party/libaom/source/libaom/av1/common/thread_common.c",
+  "//third_party/libaom/source/libaom/av1/common/thread_common.h",
+  "//third_party/libaom/source/libaom/av1/common/tile_common.c",
+  "//third_party/libaom/source/libaom/av1/common/tile_common.h",
+  "//third_party/libaom/source/libaom/av1/common/warped_motion.c",
+  "//third_party/libaom/source/libaom/av1/common/warped_motion.h",
+  "//third_party/libaom/source/libaom/av1/decoder/decodeframe.c",
+  "//third_party/libaom/source/libaom/av1/decoder/decodeframe.h",
+  "//third_party/libaom/source/libaom/av1/decoder/decodemv.c",
+  "//third_party/libaom/source/libaom/av1/decoder/decodemv.h",
+  "//third_party/libaom/source/libaom/av1/decoder/decoder.c",
+  "//third_party/libaom/source/libaom/av1/decoder/decoder.h",
+  "//third_party/libaom/source/libaom/av1/decoder/detokenize.c",
+  "//third_party/libaom/source/libaom/av1/decoder/detokenize.h",
+  "//third_party/libaom/source/libaom/av1/decoder/dsubexp.c",
+  "//third_party/libaom/source/libaom/av1/decoder/dsubexp.h",
+  "//third_party/libaom/source/libaom/av1/decoder/dthread.c",
+  "//third_party/libaom/source/libaom/av1/decoder/dthread.h",
+]
+libaom_srcs_generic_assembly = []
+libaom_srcs_generic_mmx = []
+libaom_srcs_generic_sse2 = []
+libaom_srcs_generic_sse3 = []
+libaom_srcs_generic_ssse3 = []
+libaom_srcs_generic_sse4_1 = []
+libaom_srcs_generic_avx = []
+libaom_srcs_generic_avx2 = []
diff --git a/third_party/libaom/source/config/linux/generic/aom_config.asm b/third_party/libaom/source/config/linux/generic/aom_config.asm
new file mode 100644
index 0000000..f874223
--- /dev/null
+++ b/third_party/libaom/source/config/linux/generic/aom_config.asm
@@ -0,0 +1,172 @@
+@ This file was created from a .asm file
+@  using the ads2gas.pl script.
+	.equ DO1STROUNDING, 0
+.equ ARCH_ARM ,  0
+.equ ARCH_MIPS ,  0
+.equ ARCH_X86 ,  0
+.equ ARCH_X86_64 ,  0
+.equ HAVE_NEON ,  0
+.equ HAVE_NEON_ASM ,  0
+.equ HAVE_MIPS32 ,  0
+.equ HAVE_DSPR2 ,  0
+.equ HAVE_MSA ,  0
+.equ HAVE_MIPS64 ,  0
+.equ HAVE_MMX ,  0
+.equ HAVE_SSE ,  0
+.equ HAVE_SSE2 ,  0
+.equ HAVE_SSE3 ,  0
+.equ HAVE_SSSE3 ,  0
+.equ HAVE_SSE4_1 ,  0
+.equ HAVE_AVX ,  0
+.equ HAVE_AVX2 ,  0
+.equ HAVE_AOM_PORTS ,  1
+.equ HAVE_FEXCEPT ,  1
+.equ HAVE_PTHREAD_H ,  1
+.equ HAVE_UNISTD_H ,  1
+.equ HAVE_WXWIDGETS ,  0
+.equ CONFIG_DEPENDENCY_TRACKING ,  1
+.equ CONFIG_EXTERNAL_BUILD ,  1
+.equ CONFIG_INSTALL_DOCS ,  0
+.equ CONFIG_INSTALL_BINS ,  1
+.equ CONFIG_INSTALL_LIBS ,  1
+.equ CONFIG_INSTALL_SRCS ,  0
+.equ CONFIG_DEBUG ,  0
+.equ CONFIG_GPROF ,  0
+.equ CONFIG_GCOV ,  0
+.equ CONFIG_RVCT ,  0
+.equ CONFIG_GCC ,  1
+.equ CONFIG_MSVS ,  0
+.equ CONFIG_PIC ,  0
+.equ CONFIG_BIG_ENDIAN ,  0
+.equ CONFIG_CODEC_SRCS ,  0
+.equ CONFIG_DEBUG_LIBS ,  0
+.equ CONFIG_RUNTIME_CPU_DETECT ,  0
+.equ CONFIG_POSTPROC ,  1
+.equ CONFIG_MULTITHREAD ,  1
+.equ CONFIG_INTERNAL_STATS ,  0
+.equ CONFIG_AV1_ENCODER ,  0
+.equ CONFIG_AV1_DECODER ,  1
+.equ CONFIG_AV1 ,  1
+.equ CONFIG_STATIC_MSVCRT ,  0
+.equ CONFIG_SPATIAL_RESAMPLING ,  1
+.equ CONFIG_REALTIME_ONLY ,  1
+.equ CONFIG_SHARED ,  0
+.equ CONFIG_STATIC ,  1
+.equ CONFIG_SMALL ,  0
+.equ CONFIG_POSTPROC_VISUALIZER ,  0
+.equ CONFIG_OS_SUPPORT ,  1
+.equ CONFIG_UNIT_TESTS ,  1
+.equ CONFIG_WEBM_IO ,  1
+.equ CONFIG_LIBYUV ,  1
+.equ CONFIG_ACCOUNTING ,  0
+.equ CONFIG_INSPECTION ,  0
+.equ CONFIG_DECODE_PERF_TESTS ,  0
+.equ CONFIG_ENCODE_PERF_TESTS ,  0
+.equ CONFIG_COEFFICIENT_RANGE_CHECKING ,  0
+.equ CONFIG_LOWBITDEPTH ,  1
+.equ CONFIG_HIGHBITDEPTH ,  1
+.equ CONFIG_EXPERIMENTAL ,  0
+.equ CONFIG_SIZE_LIMIT ,  1
+.equ CONFIG_FP_MB_STATS ,  0
+.equ CONFIG_CDEF ,  1
+.equ CONFIG_CDEF_SINGLEPASS ,  0
+.equ CONFIG_VAR_TX ,  1
+.equ CONFIG_RECT_TX ,  1
+.equ CONFIG_RECT_TX_EXT ,  0
+.equ CONFIG_TPL_MV ,  0
+.equ CONFIG_DUAL_FILTER ,  1
+.equ CONFIG_CONVOLVE_ROUND ,  1
+.equ CONFIG_COMPOUND_ROUND ,  0
+.equ CONFIG_EXT_TX ,  1
+.equ CONFIG_DPCM_INTRA ,  0
+.equ CONFIG_TX64X64 ,  0
+.equ CONFIG_EXT_INTRA ,  1
+.equ CONFIG_INTRA_INTERP ,  0
+.equ CONFIG_FILTER_INTRA ,  0
+.equ CONFIG_INTRA_EDGE ,  0
+.equ CONFIG_INTRABC ,  0
+.equ CONFIG_EXT_INTER ,  1
+.equ CONFIG_INTERINTRA ,  1
+.equ CONFIG_WEDGE ,  1
+.equ CONFIG_COMPOUND_SEGMENT ,  1
+.equ CONFIG_EXT_REFS ,  1
+.equ CONFIG_SPEED_REFS ,  0
+.equ CONFIG_GF_GROUPS ,  0
+.equ CONFIG_GLOBAL_MOTION ,  1
+.equ CONFIG_NEW_QUANT ,  0
+.equ CONFIG_SUPERTX ,  0
+.equ CONFIG_ANS ,  0
+.equ CONFIG_LOOP_RESTORATION ,  0
+.equ CONFIG_EXT_PARTITION ,  0
+.equ CONFIG_EXT_PARTITION_TYPES ,  0
+.equ CONFIG_UNPOISON_PARTITION_CTX ,  0
+.equ CONFIG_EXT_TILE ,  0
+.equ CONFIG_MOTION_VAR ,  1
+.equ CONFIG_NCOBMC ,  0
+.equ CONFIG_WARPED_MOTION ,  1
+.equ CONFIG_Q_ADAPT_PROBS ,  0
+.equ CONFIG_BITSTREAM_DEBUG ,  0
+.equ CONFIG_INTER_STATS_ONLY ,  0
+.equ CONFIG_PALETTE_DELTA_ENCODING ,  0
+.equ CONFIG_RAWBITS ,  0
+.equ CONFIG_PVQ ,  0
+.equ CONFIG_CFL ,  0
+.equ CONFIG_XIPHRC ,  0
+.equ CONFIG_DCT_ONLY ,  0
+.equ CONFIG_DAALA_DCT4 ,  0
+.equ CONFIG_DAALA_DCT8 ,  0
+.equ CONFIG_DAALA_DCT16 ,  0
+.equ CONFIG_DAALA_DCT32 ,  0
+.equ CONFIG_DAALA_DCT64 ,  0
+.equ CONFIG_CB4X4 ,  1
+.equ CONFIG_CHROMA_2X2 ,  0
+.equ CONFIG_CHROMA_SUB8X8 ,  1
+.equ CONFIG_FRAME_SIZE ,  0
+.equ CONFIG_DELTA_Q ,  1
+.equ CONFIG_EXT_DELTA_Q ,  1
+.equ CONFIG_ADAPT_SCAN ,  0
+.equ CONFIG_FILTER_7BIT ,  1
+.equ CONFIG_PARALLEL_DEBLOCKING ,  1
+.equ CONFIG_LOOPFILTERING_ACROSS_TILES ,  1
+.equ CONFIG_TEMPMV_SIGNALING ,  1
+.equ CONFIG_RD_DEBUG ,  0
+.equ CONFIG_REFERENCE_BUFFER ,  1
+.equ CONFIG_COEF_INTERLEAVE ,  0
+.equ CONFIG_ENTROPY_STATS ,  0
+.equ CONFIG_MASKED_TX ,  0
+.equ CONFIG_DEPENDENT_HORZTILES ,  0
+.equ CONFIG_DIST_8X8 ,  1
+.equ CONFIG_TRIPRED ,  0
+.equ CONFIG_PALETTE_THROUGHPUT ,  1
+.equ CONFIG_REF_ADAPT ,  0
+.equ CONFIG_LV_MAP ,  0
+.equ CONFIG_TXK_SEL ,  0
+.equ CONFIG_MV_COMPRESS ,  1
+.equ CONFIG_SEGMENT_ZEROMV ,  0
+.equ CONFIG_FRAME_SUPERRES ,  0
+.equ CONFIG_NEW_MULTISYMBOL ,  0
+.equ CONFIG_COMPOUND_SINGLEREF ,  0
+.equ CONFIG_AOM_QM ,  1
+.equ CONFIG_ONE_SIDED_COMPOUND ,  1
+.equ CONFIG_EXT_COMP_REFS ,  1
+.equ CONFIG_SMOOTH_HV ,  1
+.equ CONFIG_VAR_REFS ,  0
+.equ CONFIG_RECT_INTRA_PRED ,  1
+.equ CONFIG_LGT ,  0
+.equ CONFIG_SBL_SYMBOL ,  0
+.equ CONFIG_NCOBMC_ADAPT_WEIGHT ,  0
+.equ CONFIG_BGSPRITE ,  0
+.equ CONFIG_VAR_TX_NO_TX_MODE ,  0
+.equ CONFIG_MRC_TX ,  0
+.equ CONFIG_LPF_DIRECT ,  0
+.equ CONFIG_LOOPFILTER_LEVEL ,  0
+.equ CONFIG_NO_FRAME_CONTEXT_SIGNALING ,  0
+.equ CONFIG_TXMG ,  0
+.equ CONFIG_HASH_ME ,  0
+.equ CONFIG_COLORSPACE_HEADERS ,  0
+.equ CONFIG_MFMV ,  0
+.equ CONFIG_JNT_COMP ,  0
+.equ CONFIG_ANALYZER ,  0
+.equ DECODE_WIDTH_LIMIT ,  16384
+.equ DECODE_HEIGHT_LIMIT ,  16384
+	.section	.note.GNU-stack,"",%progbits
diff --git a/third_party/libaom/source/config/linux/generic/aom_config.c b/third_party/libaom/source/config/linux/generic/aom_config.c
new file mode 100644
index 0000000..796aaec
--- /dev/null
+++ b/third_party/libaom/source/config/linux/generic/aom_config.c
@@ -0,0 +1,11 @@
+/* Copyright (c) 2016, Alliance for Open Media. All rights reserved. */
+/*  */
+/* This source code is subject to the terms of the BSD 2 Clause License and */
+/* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License */
+/* was not distributed with this source code in the LICENSE file, you can */
+/* obtain it at www.aomedia.org/license/software. If the Alliance for Open */
+/* Media Patent License 1.0 was not distributed with this source code in the */
+/* PATENTS file, you can obtain it at www.aomedia.org/license/patent. */
+#include "aom/aom_codec.h"
+static const char* const cfg = "--target=generic-gnu --enable-external-build --enable-postproc --disable-av1-encoder --size-limit=16384x16384 --enable-realtime-only --disable-install-docs";
+const char *aom_codec_build_config(void) {return cfg;}
diff --git a/third_party/libaom/source/config/linux/generic/aom_config.h b/third_party/libaom/source/config/linux/generic/aom_config.h
new file mode 100644
index 0000000..db0a1645
--- /dev/null
+++ b/third_party/libaom/source/config/linux/generic/aom_config.h
@@ -0,0 +1,182 @@
+/* Copyright (c) 2016, Alliance for Open Media. All rights reserved. */
+/*  */
+/* This source code is subject to the terms of the BSD 2 Clause License and */
+/* the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License */
+/* was not distributed with this source code in the LICENSE file, you can */
+/* obtain it at www.aomedia.org/license/software. If the Alliance for Open */
+/* Media Patent License 1.0 was not distributed with this source code in the */
+/* PATENTS file, you can obtain it at www.aomedia.org/license/patent. */
+/* This file automatically generated by configure. Do not edit! */
+#ifndef AOM_CONFIG_H
+#define AOM_CONFIG_H
+#define RESTRICT    
+#define INLINE      inline
+#define ARCH_ARM 0
+#define ARCH_MIPS 0
+#define ARCH_X86 0
+#define ARCH_X86_64 0
+#define HAVE_NEON 0
+#define HAVE_NEON_ASM 0
+#define HAVE_MIPS32 0
+#define HAVE_DSPR2 0
+#define HAVE_MSA 0
+#define HAVE_MIPS64 0
+#define HAVE_MMX 0
+#define HAVE_SSE 0
+#define HAVE_SSE2 0
+#define HAVE_SSE3 0
+#define HAVE_SSSE3 0
+#define HAVE_SSE4_1 0
+#define HAVE_AVX 0
+#define HAVE_AVX2 0
+#define HAVE_AOM_PORTS 1
+#define HAVE_FEXCEPT 1
+#define HAVE_PTHREAD_H 1
+#define HAVE_UNISTD_H 1
+#define HAVE_WXWIDGETS 0
+#define CONFIG_DEPENDENCY_TRACKING 1
+#define CONFIG_EXTERNAL_BUILD 1
+#define CONFIG_INSTALL_DOCS 0
+#define CONFIG_INSTALL_BINS 1
+#define CONFIG_INSTALL_LIBS 1
+#define CONFIG_INSTALL_SRCS 0
+#define CONFIG_DEBUG 0
+#define CONFIG_GPROF 0
+#define CONFIG_GCOV 0
+#define CONFIG_RVCT 0
+#define CONFIG_GCC 1
+#define CONFIG_MSVS 0
+#define CONFIG_PIC 0
+#define CONFIG_BIG_ENDIAN 0
+#define CONFIG_CODEC_SRCS 0
+#define CONFIG_DEBUG_LIBS 0
+#define CONFIG_RUNTIME_CPU_DETECT 0
+#define CONFIG_POSTPROC 1
+#define CONFIG_MULTITHREAD 1
+#define CONFIG_INTERNAL_STATS 0
+#define CONFIG_AV1_ENCODER 0
+#define CONFIG_AV1_DECODER 1
+#define CONFIG_AV1 1
+#define CONFIG_STATIC_MSVCRT 0
+#define CONFIG_SPATIAL_RESAMPLING 1
+#define CONFIG_REALTIME_ONLY 1
+#define CONFIG_SHARED 0
+#define CONFIG_STATIC 1
+#define CONFIG_SMALL 0
+#define CONFIG_POSTPROC_VISUALIZER 0
+#define CONFIG_OS_SUPPORT 1
+#define CONFIG_UNIT_TESTS 1
+#define CONFIG_WEBM_IO 1
+#define CONFIG_LIBYUV 1
+#define CONFIG_ACCOUNTING 0
+#define CONFIG_INSPECTION 0
+#define CONFIG_DECODE_PERF_TESTS 0
+#define CONFIG_ENCODE_PERF_TESTS 0
+#define CONFIG_COEFFICIENT_RANGE_CHECKING 0
+#define CONFIG_LOWBITDEPTH 1
+#define CONFIG_HIGHBITDEPTH 1
+#define CONFIG_EXPERIMENTAL 0
+#define CONFIG_SIZE_LIMIT 1
+#define CONFIG_FP_MB_STATS 0
+#define CONFIG_CDEF 1
+#define CONFIG_CDEF_SINGLEPASS 0
+#define CONFIG_VAR_TX 1
+#define CONFIG_RECT_TX 1
+#define CONFIG_RECT_TX_EXT 0
+#define CONFIG_TPL_MV 0
+#define CONFIG_DUAL_FILTER 1
+#define CONFIG_CONVOLVE_ROUND 1
+#define CONFIG_COMPOUND_ROUND 0
+#define CONFIG_EXT_TX 1
+#define CONFIG_DPCM_INTRA 0
+#define CONFIG_TX64X64 0
+#define CONFIG_EXT_INTRA 1
+#define CONFIG_INTRA_INTERP 0
+#define CONFIG_FILTER_INTRA 0
+#define CONFIG_INTRA_EDGE 0
+#define CONFIG_INTRABC 0
+#define CONFIG_EXT_INTER 1
+#define CONFIG_INTERINTRA 1
+#define CONFIG_WEDGE 1
+#define CONFIG_COMPOUND_SEGMENT 1
+#define CONFIG_EXT_REFS 1
+#define CONFIG_SPEED_REFS 0
+#define CONFIG_GF_GROUPS 0
+#define CONFIG_GLOBAL_MOTION 1
+#define CONFIG_NEW_QUANT 0
+#define CONFIG_SUPERTX 0
+#define CONFIG_ANS 0
+#define CONFIG_LOOP_RESTORATION 0
+#define CONFIG_EXT_PARTITION 0
+#define CONFIG_EXT_PARTITION_TYPES 0
+#define CONFIG_UNPOISON_PARTITION_CTX 0
+#define CONFIG_EXT_TILE 0
+#define CONFIG_MOTION_VAR 1
+#define CONFIG_NCOBMC 0
+#define CONFIG_WARPED_MOTION 1
+#define CONFIG_Q_ADAPT_PROBS 0
+#define CONFIG_BITSTREAM_DEBUG 0
+#define CONFIG_INTER_STATS_ONLY 0
+#define CONFIG_PALETTE_DELTA_ENCODING 0
+#define CONFIG_RAWBITS 0
+#define CONFIG_PVQ 0
+#define CONFIG_CFL 0
+#define CONFIG_XIPHRC 0
+#define CONFIG_DCT_ONLY 0
+#define CONFIG_DAALA_DCT4 0
+#define CONFIG_DAALA_DCT8 0
+#define CONFIG_DAALA_DCT16 0
+#define CONFIG_DAALA_DCT32 0
+#define CONFIG_DAALA_DCT64 0
+#define CONFIG_CB4X4 1
+#define CONFIG_CHROMA_2X2 0
+#define CONFIG_CHROMA_SUB8X8 1
+#define CONFIG_FRAME_SIZE 0
+#define CONFIG_DELTA_Q 1
+#define CONFIG_EXT_DELTA_Q 1
+#define CONFIG_ADAPT_SCAN 0
+#define CONFIG_FILTER_7BIT 1
+#define CONFIG_PARALLEL_DEBLOCKING 1
+#define CONFIG_LOOPFILTERING_ACROSS_TILES 1
+#define CONFIG_TEMPMV_SIGNALING 1
+#define CONFIG_RD_DEBUG 0
+#define CONFIG_REFERENCE_BUFFER 1
+#define CONFIG_COEF_INTERLEAVE 0
+#define CONFIG_ENTROPY_STATS 0
+#define CONFIG_MASKED_TX 0
+#define CONFIG_DEPENDENT_HORZTILES 0
+#define CONFIG_DIST_8X8 1
+#define CONFIG_TRIPRED 0
+#define CONFIG_PALETTE_THROUGHPUT 1
+#define CONFIG_REF_ADAPT 0
+#define CONFIG_LV_MAP 0
+#define CONFIG_TXK_SEL 0
+#define CONFIG_MV_COMPRESS 1
+#define CONFIG_SEGMENT_ZEROMV 0
+#define CONFIG_FRAME_SUPERRES 0
+#define CONFIG_NEW_MULTISYMBOL 0
+#define CONFIG_COMPOUND_SINGLEREF 0
+#define CONFIG_AOM_QM 1
+#define CONFIG_ONE_SIDED_COMPOUND 1
+#define CONFIG_EXT_COMP_REFS 1
+#define CONFIG_SMOOTH_HV 1
+#define CONFIG_VAR_REFS 0
+#define CONFIG_RECT_INTRA_PRED 1
+#define CONFIG_LGT 0
+#define CONFIG_SBL_SYMBOL 0
+#define CONFIG_NCOBMC_ADAPT_WEIGHT 0
+#define CONFIG_BGSPRITE 0
+#define CONFIG_VAR_TX_NO_TX_MODE 0
+#define CONFIG_MRC_TX 0
+#define CONFIG_LPF_DIRECT 0
+#define CONFIG_LOOPFILTER_LEVEL 0
+#define CONFIG_NO_FRAME_CONTEXT_SIGNALING 0
+#define CONFIG_TXMG 0
+#define CONFIG_HASH_ME 0
+#define CONFIG_COLORSPACE_HEADERS 0
+#define CONFIG_MFMV 0
+#define CONFIG_JNT_COMP 0
+#define CONFIG_ANALYZER 0
+#define DECODE_WIDTH_LIMIT 16384
+#define DECODE_HEIGHT_LIMIT 16384
+#endif /* AOM_CONFIG_H */
diff --git a/third_party/libaom/source/config/linux/generic/aom_dsp_rtcd.h b/third_party/libaom/source/config/linux/generic/aom_dsp_rtcd.h
new file mode 100644
index 0000000..2e46aa7
--- /dev/null
+++ b/third_party/libaom/source/config/linux/generic/aom_dsp_rtcd.h
@@ -0,0 +1,3066 @@
+#ifndef AOM_DSP_RTCD_H_
+#define AOM_DSP_RTCD_H_
+
+#ifdef RTCD_C
+#define RTCD_EXTERN
+#else
+#define RTCD_EXTERN extern
+#endif
+
+/*
+ * DSP
+ */
+
+#include "aom/aom_integer.h"
+#include "aom_dsp/aom_dsp_common.h"
+#include "av1/common/enums.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void aom_blend_a64_d32_mask_c(int32_t* dst,
+                              uint32_t dst_stride,
+                              const int32_t* src0,
+                              uint32_t src0_stride,
+                              const int32_t* src1,
+                              uint32_t src1_stride,
+                              const uint8_t* mask,
+                              uint32_t mask_stride,
+                              int h,
+                              int w,
+                              int suby,
+                              int subx);
+#define aom_blend_a64_d32_mask aom_blend_a64_d32_mask_c
+
+void aom_blend_a64_hmask_c(uint8_t* dst,
+                           uint32_t dst_stride,
+                           const uint8_t* src0,
+                           uint32_t src0_stride,
+                           const uint8_t* src1,
+                           uint32_t src1_stride,
+                           const uint8_t* mask,
+                           int h,
+                           int w);
+#define aom_blend_a64_hmask aom_blend_a64_hmask_c
+
+void aom_blend_a64_mask_c(uint8_t* dst,
+                          uint32_t dst_stride,
+                          const uint8_t* src0,
+                          uint32_t src0_stride,
+                          const uint8_t* src1,
+                          uint32_t src1_stride,
+                          const uint8_t* mask,
+                          uint32_t mask_stride,
+                          int h,
+                          int w,
+                          int suby,
+                          int subx);
+#define aom_blend_a64_mask aom_blend_a64_mask_c
+
+void aom_blend_a64_vmask_c(uint8_t* dst,
+                           uint32_t dst_stride,
+                           const uint8_t* src0,
+                           uint32_t src0_stride,
+                           const uint8_t* src1,
+                           uint32_t src1_stride,
+                           const uint8_t* mask,
+                           int h,
+                           int w);
+#define aom_blend_a64_vmask aom_blend_a64_vmask_c
+
+void aom_convolve8_c(const uint8_t* src,
+                     ptrdiff_t src_stride,
+                     uint8_t* dst,
+                     ptrdiff_t dst_stride,
+                     const int16_t* filter_x,
+                     int x_step_q4,
+                     const int16_t* filter_y,
+                     int y_step_q4,
+                     int w,
+                     int h);
+#define aom_convolve8 aom_convolve8_c
+
+void aom_convolve8_avg_c(const uint8_t* src,
+                         ptrdiff_t src_stride,
+                         uint8_t* dst,
+                         ptrdiff_t dst_stride,
+                         const int16_t* filter_x,
+                         int x_step_q4,
+                         const int16_t* filter_y,
+                         int y_step_q4,
+                         int w,
+                         int h);
+#define aom_convolve8_avg aom_convolve8_avg_c
+
+void aom_convolve8_avg_horiz_c(const uint8_t* src,
+                               ptrdiff_t src_stride,
+                               uint8_t* dst,
+                               ptrdiff_t dst_stride,
+                               const int16_t* filter_x,
+                               int x_step_q4,
+                               const int16_t* filter_y,
+                               int y_step_q4,
+                               int w,
+                               int h);
+#define aom_convolve8_avg_horiz aom_convolve8_avg_horiz_c
+
+void aom_convolve8_avg_horiz_scale_c(const uint8_t* src,
+                                     ptrdiff_t src_stride,
+                                     uint8_t* dst,
+                                     ptrdiff_t dst_stride,
+                                     const int16_t* filter_x,
+                                     int subpel_x,
+                                     int x_step_q4,
+                                     const int16_t* filter_y,
+                                     int subpel_y,
+                                     int y_step_q4,
+                                     int w,
+                                     int h);
+#define aom_convolve8_avg_horiz_scale aom_convolve8_avg_horiz_scale_c
+
+void aom_convolve8_avg_scale_c(const uint8_t* src,
+                               ptrdiff_t src_stride,
+                               uint8_t* dst,
+                               ptrdiff_t dst_stride,
+                               const int16_t* filter_x,
+                               int subpel_x,
+                               int x_step_q4,
+                               const int16_t* filter_y,
+                               int subpel_y,
+                               int y_step_q4,
+                               int w,
+                               int h);
+#define aom_convolve8_avg_scale aom_convolve8_avg_scale_c
+
+void aom_convolve8_avg_vert_c(const uint8_t* src,
+                              ptrdiff_t src_stride,
+                              uint8_t* dst,
+                              ptrdiff_t dst_stride,
+                              const int16_t* filter_x,
+                              int x_step_q4,
+                              const int16_t* filter_y,
+                              int y_step_q4,
+                              int w,
+                              int h);
+#define aom_convolve8_avg_vert aom_convolve8_avg_vert_c
+
+void aom_convolve8_avg_vert_scale_c(const uint8_t* src,
+                                    ptrdiff_t src_stride,
+                                    uint8_t* dst,
+                                    ptrdiff_t dst_stride,
+                                    const int16_t* filter_x,
+                                    int subpel_x,
+                                    int x_step_q4,
+                                    const int16_t* filter_y,
+                                    int subpel_y,
+                                    int y_step_q4,
+                                    int w,
+                                    int h);
+#define aom_convolve8_avg_vert_scale aom_convolve8_avg_vert_scale_c
+
+void aom_convolve8_horiz_c(const uint8_t* src,
+                           ptrdiff_t src_stride,
+                           uint8_t* dst,
+                           ptrdiff_t dst_stride,
+                           const int16_t* filter_x,
+                           int x_step_q4,
+                           const int16_t* filter_y,
+                           int y_step_q4,
+                           int w,
+                           int h);
+#define aom_convolve8_horiz aom_convolve8_horiz_c
+
+void aom_convolve8_horiz_scale_c(const uint8_t* src,
+                                 ptrdiff_t src_stride,
+                                 uint8_t* dst,
+                                 ptrdiff_t dst_stride,
+                                 const int16_t* filter_x,
+                                 int subpel_x,
+                                 int x_step_q4,
+                                 const int16_t* filter_y,
+                                 int subpel_y,
+                                 int y_step_q4,
+                                 int w,
+                                 int h);
+#define aom_convolve8_horiz_scale aom_convolve8_horiz_scale_c
+
+void aom_convolve8_scale_c(const uint8_t* src,
+                           ptrdiff_t src_stride,
+                           uint8_t* dst,
+                           ptrdiff_t dst_stride,
+                           const int16_t* filter_x,
+                           int subpel_x,
+                           int x_step_q4,
+                           const int16_t* filter_y,
+                           int subpel_y,
+                           int y_step_q4,
+                           int w,
+                           int h);
+#define aom_convolve8_scale aom_convolve8_scale_c
+
+void aom_convolve8_vert_c(const uint8_t* src,
+                          ptrdiff_t src_stride,
+                          uint8_t* dst,
+                          ptrdiff_t dst_stride,
+                          const int16_t* filter_x,
+                          int x_step_q4,
+                          const int16_t* filter_y,
+                          int y_step_q4,
+                          int w,
+                          int h);
+#define aom_convolve8_vert aom_convolve8_vert_c
+
+void aom_convolve8_vert_scale_c(const uint8_t* src,
+                                ptrdiff_t src_stride,
+                                uint8_t* dst,
+                                ptrdiff_t dst_stride,
+                                const int16_t* filter_x,
+                                int subpel_x,
+                                int x_step_q4,
+                                const int16_t* filter_y,
+                                int subpel_y,
+                                int y_step_q4,
+                                int w,
+                                int h);
+#define aom_convolve8_vert_scale aom_convolve8_vert_scale_c
+
+void aom_convolve_avg_c(const uint8_t* src,
+                        ptrdiff_t src_stride,
+                        uint8_t* dst,
+                        ptrdiff_t dst_stride,
+                        const int16_t* filter_x,
+                        int x_step_q4,
+                        const int16_t* filter_y,
+                        int y_step_q4,
+                        int w,
+                        int h);
+#define aom_convolve_avg aom_convolve_avg_c
+
+void aom_convolve_copy_c(const uint8_t* src,
+                         ptrdiff_t src_stride,
+                         uint8_t* dst,
+                         ptrdiff_t dst_stride,
+                         const int16_t* filter_x,
+                         int x_step_q4,
+                         const int16_t* filter_y,
+                         int y_step_q4,
+                         int w,
+                         int h);
+#define aom_convolve_copy aom_convolve_copy_c
+
+void aom_d117_predictor_16x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d117_predictor_16x16 aom_d117_predictor_16x16_c
+
+void aom_d117_predictor_16x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d117_predictor_16x32 aom_d117_predictor_16x32_c
+
+void aom_d117_predictor_16x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d117_predictor_16x8 aom_d117_predictor_16x8_c
+
+void aom_d117_predictor_2x2_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d117_predictor_2x2 aom_d117_predictor_2x2_c
+
+void aom_d117_predictor_32x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d117_predictor_32x16 aom_d117_predictor_32x16_c
+
+void aom_d117_predictor_32x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d117_predictor_32x32 aom_d117_predictor_32x32_c
+
+void aom_d117_predictor_4x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d117_predictor_4x4 aom_d117_predictor_4x4_c
+
+void aom_d117_predictor_4x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d117_predictor_4x8 aom_d117_predictor_4x8_c
+
+void aom_d117_predictor_8x16_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d117_predictor_8x16 aom_d117_predictor_8x16_c
+
+void aom_d117_predictor_8x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d117_predictor_8x4 aom_d117_predictor_8x4_c
+
+void aom_d117_predictor_8x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d117_predictor_8x8 aom_d117_predictor_8x8_c
+
+void aom_d135_predictor_16x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d135_predictor_16x16 aom_d135_predictor_16x16_c
+
+void aom_d135_predictor_16x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d135_predictor_16x32 aom_d135_predictor_16x32_c
+
+void aom_d135_predictor_16x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d135_predictor_16x8 aom_d135_predictor_16x8_c
+
+void aom_d135_predictor_2x2_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d135_predictor_2x2 aom_d135_predictor_2x2_c
+
+void aom_d135_predictor_32x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d135_predictor_32x16 aom_d135_predictor_32x16_c
+
+void aom_d135_predictor_32x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d135_predictor_32x32 aom_d135_predictor_32x32_c
+
+void aom_d135_predictor_4x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d135_predictor_4x4 aom_d135_predictor_4x4_c
+
+void aom_d135_predictor_4x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d135_predictor_4x8 aom_d135_predictor_4x8_c
+
+void aom_d135_predictor_8x16_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d135_predictor_8x16 aom_d135_predictor_8x16_c
+
+void aom_d135_predictor_8x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d135_predictor_8x4 aom_d135_predictor_8x4_c
+
+void aom_d135_predictor_8x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d135_predictor_8x8 aom_d135_predictor_8x8_c
+
+void aom_d153_predictor_16x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d153_predictor_16x16 aom_d153_predictor_16x16_c
+
+void aom_d153_predictor_16x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d153_predictor_16x32 aom_d153_predictor_16x32_c
+
+void aom_d153_predictor_16x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d153_predictor_16x8 aom_d153_predictor_16x8_c
+
+void aom_d153_predictor_2x2_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d153_predictor_2x2 aom_d153_predictor_2x2_c
+
+void aom_d153_predictor_32x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d153_predictor_32x16 aom_d153_predictor_32x16_c
+
+void aom_d153_predictor_32x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d153_predictor_32x32 aom_d153_predictor_32x32_c
+
+void aom_d153_predictor_4x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d153_predictor_4x4 aom_d153_predictor_4x4_c
+
+void aom_d153_predictor_4x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d153_predictor_4x8 aom_d153_predictor_4x8_c
+
+void aom_d153_predictor_8x16_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d153_predictor_8x16 aom_d153_predictor_8x16_c
+
+void aom_d153_predictor_8x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d153_predictor_8x4 aom_d153_predictor_8x4_c
+
+void aom_d153_predictor_8x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d153_predictor_8x8 aom_d153_predictor_8x8_c
+
+void aom_d207e_predictor_16x16_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_d207e_predictor_16x16 aom_d207e_predictor_16x16_c
+
+void aom_d207e_predictor_16x32_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_d207e_predictor_16x32 aom_d207e_predictor_16x32_c
+
+void aom_d207e_predictor_16x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d207e_predictor_16x8 aom_d207e_predictor_16x8_c
+
+void aom_d207e_predictor_2x2_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d207e_predictor_2x2 aom_d207e_predictor_2x2_c
+
+void aom_d207e_predictor_32x16_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_d207e_predictor_32x16 aom_d207e_predictor_32x16_c
+
+void aom_d207e_predictor_32x32_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_d207e_predictor_32x32 aom_d207e_predictor_32x32_c
+
+void aom_d207e_predictor_4x4_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d207e_predictor_4x4 aom_d207e_predictor_4x4_c
+
+void aom_d207e_predictor_4x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d207e_predictor_4x8 aom_d207e_predictor_4x8_c
+
+void aom_d207e_predictor_8x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d207e_predictor_8x16 aom_d207e_predictor_8x16_c
+
+void aom_d207e_predictor_8x4_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d207e_predictor_8x4 aom_d207e_predictor_8x4_c
+
+void aom_d207e_predictor_8x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d207e_predictor_8x8 aom_d207e_predictor_8x8_c
+
+void aom_d45e_predictor_16x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d45e_predictor_16x16 aom_d45e_predictor_16x16_c
+
+void aom_d45e_predictor_16x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d45e_predictor_16x32 aom_d45e_predictor_16x32_c
+
+void aom_d45e_predictor_16x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d45e_predictor_16x8 aom_d45e_predictor_16x8_c
+
+void aom_d45e_predictor_2x2_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d45e_predictor_2x2 aom_d45e_predictor_2x2_c
+
+void aom_d45e_predictor_32x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d45e_predictor_32x16 aom_d45e_predictor_32x16_c
+
+void aom_d45e_predictor_32x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d45e_predictor_32x32 aom_d45e_predictor_32x32_c
+
+void aom_d45e_predictor_4x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d45e_predictor_4x4 aom_d45e_predictor_4x4_c
+
+void aom_d45e_predictor_4x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d45e_predictor_4x8 aom_d45e_predictor_4x8_c
+
+void aom_d45e_predictor_8x16_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d45e_predictor_8x16 aom_d45e_predictor_8x16_c
+
+void aom_d45e_predictor_8x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d45e_predictor_8x4 aom_d45e_predictor_8x4_c
+
+void aom_d45e_predictor_8x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d45e_predictor_8x8 aom_d45e_predictor_8x8_c
+
+void aom_d63e_predictor_16x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d63e_predictor_16x16 aom_d63e_predictor_16x16_c
+
+void aom_d63e_predictor_16x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d63e_predictor_16x32 aom_d63e_predictor_16x32_c
+
+void aom_d63e_predictor_16x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d63e_predictor_16x8 aom_d63e_predictor_16x8_c
+
+void aom_d63e_predictor_2x2_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d63e_predictor_2x2 aom_d63e_predictor_2x2_c
+
+void aom_d63e_predictor_32x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d63e_predictor_32x16 aom_d63e_predictor_32x16_c
+
+void aom_d63e_predictor_32x32_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_d63e_predictor_32x32 aom_d63e_predictor_32x32_c
+
+void aom_d63e_predictor_4x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d63e_predictor_4x4 aom_d63e_predictor_4x4_c
+
+void aom_d63e_predictor_4x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d63e_predictor_4x8 aom_d63e_predictor_4x8_c
+
+void aom_d63e_predictor_8x16_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_d63e_predictor_8x16 aom_d63e_predictor_8x16_c
+
+void aom_d63e_predictor_8x4_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d63e_predictor_8x4 aom_d63e_predictor_8x4_c
+
+void aom_d63e_predictor_8x8_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_d63e_predictor_8x8 aom_d63e_predictor_8x8_c
+
+void aom_dc_128_predictor_16x16_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_128_predictor_16x16 aom_dc_128_predictor_16x16_c
+
+void aom_dc_128_predictor_16x32_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_128_predictor_16x32 aom_dc_128_predictor_16x32_c
+
+void aom_dc_128_predictor_16x8_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_128_predictor_16x8 aom_dc_128_predictor_16x8_c
+
+void aom_dc_128_predictor_2x2_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_128_predictor_2x2 aom_dc_128_predictor_2x2_c
+
+void aom_dc_128_predictor_32x16_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_128_predictor_32x16 aom_dc_128_predictor_32x16_c
+
+void aom_dc_128_predictor_32x32_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_128_predictor_32x32 aom_dc_128_predictor_32x32_c
+
+void aom_dc_128_predictor_4x4_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_128_predictor_4x4 aom_dc_128_predictor_4x4_c
+
+void aom_dc_128_predictor_4x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_128_predictor_4x8 aom_dc_128_predictor_4x8_c
+
+void aom_dc_128_predictor_8x16_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_128_predictor_8x16 aom_dc_128_predictor_8x16_c
+
+void aom_dc_128_predictor_8x4_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_128_predictor_8x4 aom_dc_128_predictor_8x4_c
+
+void aom_dc_128_predictor_8x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_128_predictor_8x8 aom_dc_128_predictor_8x8_c
+
+void aom_dc_left_predictor_16x16_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_dc_left_predictor_16x16 aom_dc_left_predictor_16x16_c
+
+void aom_dc_left_predictor_16x32_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_dc_left_predictor_16x32 aom_dc_left_predictor_16x32_c
+
+void aom_dc_left_predictor_16x8_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_left_predictor_16x8 aom_dc_left_predictor_16x8_c
+
+void aom_dc_left_predictor_2x2_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_left_predictor_2x2 aom_dc_left_predictor_2x2_c
+
+void aom_dc_left_predictor_32x16_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_dc_left_predictor_32x16 aom_dc_left_predictor_32x16_c
+
+void aom_dc_left_predictor_32x32_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_dc_left_predictor_32x32 aom_dc_left_predictor_32x32_c
+
+void aom_dc_left_predictor_4x4_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_left_predictor_4x4 aom_dc_left_predictor_4x4_c
+
+void aom_dc_left_predictor_4x8_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_left_predictor_4x8 aom_dc_left_predictor_4x8_c
+
+void aom_dc_left_predictor_8x16_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_left_predictor_8x16 aom_dc_left_predictor_8x16_c
+
+void aom_dc_left_predictor_8x4_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_left_predictor_8x4 aom_dc_left_predictor_8x4_c
+
+void aom_dc_left_predictor_8x8_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_left_predictor_8x8 aom_dc_left_predictor_8x8_c
+
+void aom_dc_predictor_16x16_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_dc_predictor_16x16 aom_dc_predictor_16x16_c
+
+void aom_dc_predictor_16x32_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_dc_predictor_16x32 aom_dc_predictor_16x32_c
+
+void aom_dc_predictor_16x8_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_dc_predictor_16x8 aom_dc_predictor_16x8_c
+
+void aom_dc_predictor_2x2_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_dc_predictor_2x2 aom_dc_predictor_2x2_c
+
+void aom_dc_predictor_32x16_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_dc_predictor_32x16 aom_dc_predictor_32x16_c
+
+void aom_dc_predictor_32x32_c(uint8_t* dst,
+                              ptrdiff_t y_stride,
+                              const uint8_t* above,
+                              const uint8_t* left);
+#define aom_dc_predictor_32x32 aom_dc_predictor_32x32_c
+
+void aom_dc_predictor_4x4_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_dc_predictor_4x4 aom_dc_predictor_4x4_c
+
+void aom_dc_predictor_4x8_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_dc_predictor_4x8 aom_dc_predictor_4x8_c
+
+void aom_dc_predictor_8x16_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_dc_predictor_8x16 aom_dc_predictor_8x16_c
+
+void aom_dc_predictor_8x4_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_dc_predictor_8x4 aom_dc_predictor_8x4_c
+
+void aom_dc_predictor_8x8_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_dc_predictor_8x8 aom_dc_predictor_8x8_c
+
+void aom_dc_top_predictor_16x16_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_top_predictor_16x16 aom_dc_top_predictor_16x16_c
+
+void aom_dc_top_predictor_16x32_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_top_predictor_16x32 aom_dc_top_predictor_16x32_c
+
+void aom_dc_top_predictor_16x8_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_top_predictor_16x8 aom_dc_top_predictor_16x8_c
+
+void aom_dc_top_predictor_2x2_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_top_predictor_2x2 aom_dc_top_predictor_2x2_c
+
+void aom_dc_top_predictor_32x16_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_top_predictor_32x16 aom_dc_top_predictor_32x16_c
+
+void aom_dc_top_predictor_32x32_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_dc_top_predictor_32x32 aom_dc_top_predictor_32x32_c
+
+void aom_dc_top_predictor_4x4_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_top_predictor_4x4 aom_dc_top_predictor_4x4_c
+
+void aom_dc_top_predictor_4x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_top_predictor_4x8 aom_dc_top_predictor_4x8_c
+
+void aom_dc_top_predictor_8x16_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_dc_top_predictor_8x16 aom_dc_top_predictor_8x16_c
+
+void aom_dc_top_predictor_8x4_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_top_predictor_8x4 aom_dc_top_predictor_8x4_c
+
+void aom_dc_top_predictor_8x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_dc_top_predictor_8x8 aom_dc_top_predictor_8x8_c
+
+void aom_h_predictor_16x16_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_h_predictor_16x16 aom_h_predictor_16x16_c
+
+void aom_h_predictor_16x32_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_h_predictor_16x32 aom_h_predictor_16x32_c
+
+void aom_h_predictor_16x8_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_h_predictor_16x8 aom_h_predictor_16x8_c
+
+void aom_h_predictor_2x2_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_h_predictor_2x2 aom_h_predictor_2x2_c
+
+void aom_h_predictor_32x16_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_h_predictor_32x16 aom_h_predictor_32x16_c
+
+void aom_h_predictor_32x32_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_h_predictor_32x32 aom_h_predictor_32x32_c
+
+void aom_h_predictor_4x4_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_h_predictor_4x4 aom_h_predictor_4x4_c
+
+void aom_h_predictor_4x8_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_h_predictor_4x8 aom_h_predictor_4x8_c
+
+void aom_h_predictor_8x16_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_h_predictor_8x16 aom_h_predictor_8x16_c
+
+void aom_h_predictor_8x4_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_h_predictor_8x4 aom_h_predictor_8x4_c
+
+void aom_h_predictor_8x8_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_h_predictor_8x8 aom_h_predictor_8x8_c
+
+void aom_highbd_blend_a64_hmask_c(uint8_t* dst,
+                                  uint32_t dst_stride,
+                                  const uint8_t* src0,
+                                  uint32_t src0_stride,
+                                  const uint8_t* src1,
+                                  uint32_t src1_stride,
+                                  const uint8_t* mask,
+                                  int h,
+                                  int w,
+                                  int bd);
+#define aom_highbd_blend_a64_hmask aom_highbd_blend_a64_hmask_c
+
+void aom_highbd_blend_a64_mask_c(uint8_t* dst,
+                                 uint32_t dst_stride,
+                                 const uint8_t* src0,
+                                 uint32_t src0_stride,
+                                 const uint8_t* src1,
+                                 uint32_t src1_stride,
+                                 const uint8_t* mask,
+                                 uint32_t mask_stride,
+                                 int h,
+                                 int w,
+                                 int suby,
+                                 int subx,
+                                 int bd);
+#define aom_highbd_blend_a64_mask aom_highbd_blend_a64_mask_c
+
+void aom_highbd_blend_a64_vmask_c(uint8_t* dst,
+                                  uint32_t dst_stride,
+                                  const uint8_t* src0,
+                                  uint32_t src0_stride,
+                                  const uint8_t* src1,
+                                  uint32_t src1_stride,
+                                  const uint8_t* mask,
+                                  int h,
+                                  int w,
+                                  int bd);
+#define aom_highbd_blend_a64_vmask aom_highbd_blend_a64_vmask_c
+
+void aom_highbd_convolve8_c(const uint8_t* src,
+                            ptrdiff_t src_stride,
+                            uint8_t* dst,
+                            ptrdiff_t dst_stride,
+                            const int16_t* filter_x,
+                            int x_step_q4,
+                            const int16_t* filter_y,
+                            int y_step_q4,
+                            int w,
+                            int h,
+                            int bps);
+#define aom_highbd_convolve8 aom_highbd_convolve8_c
+
+void aom_highbd_convolve8_avg_c(const uint8_t* src,
+                                ptrdiff_t src_stride,
+                                uint8_t* dst,
+                                ptrdiff_t dst_stride,
+                                const int16_t* filter_x,
+                                int x_step_q4,
+                                const int16_t* filter_y,
+                                int y_step_q4,
+                                int w,
+                                int h,
+                                int bps);
+#define aom_highbd_convolve8_avg aom_highbd_convolve8_avg_c
+
+void aom_highbd_convolve8_avg_horiz_c(const uint8_t* src,
+                                      ptrdiff_t src_stride,
+                                      uint8_t* dst,
+                                      ptrdiff_t dst_stride,
+                                      const int16_t* filter_x,
+                                      int x_step_q4,
+                                      const int16_t* filter_y,
+                                      int y_step_q4,
+                                      int w,
+                                      int h,
+                                      int bps);
+#define aom_highbd_convolve8_avg_horiz aom_highbd_convolve8_avg_horiz_c
+
+void aom_highbd_convolve8_avg_vert_c(const uint8_t* src,
+                                     ptrdiff_t src_stride,
+                                     uint8_t* dst,
+                                     ptrdiff_t dst_stride,
+                                     const int16_t* filter_x,
+                                     int x_step_q4,
+                                     const int16_t* filter_y,
+                                     int y_step_q4,
+                                     int w,
+                                     int h,
+                                     int bps);
+#define aom_highbd_convolve8_avg_vert aom_highbd_convolve8_avg_vert_c
+
+void aom_highbd_convolve8_horiz_c(const uint8_t* src,
+                                  ptrdiff_t src_stride,
+                                  uint8_t* dst,
+                                  ptrdiff_t dst_stride,
+                                  const int16_t* filter_x,
+                                  int x_step_q4,
+                                  const int16_t* filter_y,
+                                  int y_step_q4,
+                                  int w,
+                                  int h,
+                                  int bps);
+#define aom_highbd_convolve8_horiz aom_highbd_convolve8_horiz_c
+
+void aom_highbd_convolve8_vert_c(const uint8_t* src,
+                                 ptrdiff_t src_stride,
+                                 uint8_t* dst,
+                                 ptrdiff_t dst_stride,
+                                 const int16_t* filter_x,
+                                 int x_step_q4,
+                                 const int16_t* filter_y,
+                                 int y_step_q4,
+                                 int w,
+                                 int h,
+                                 int bps);
+#define aom_highbd_convolve8_vert aom_highbd_convolve8_vert_c
+
+void aom_highbd_convolve_avg_c(const uint8_t* src,
+                               ptrdiff_t src_stride,
+                               uint8_t* dst,
+                               ptrdiff_t dst_stride,
+                               const int16_t* filter_x,
+                               int x_step_q4,
+                               const int16_t* filter_y,
+                               int y_step_q4,
+                               int w,
+                               int h,
+                               int bps);
+#define aom_highbd_convolve_avg aom_highbd_convolve_avg_c
+
+void aom_highbd_convolve_copy_c(const uint8_t* src,
+                                ptrdiff_t src_stride,
+                                uint8_t* dst,
+                                ptrdiff_t dst_stride,
+                                const int16_t* filter_x,
+                                int x_step_q4,
+                                const int16_t* filter_y,
+                                int y_step_q4,
+                                int w,
+                                int h,
+                                int bps);
+#define aom_highbd_convolve_copy aom_highbd_convolve_copy_c
+
+void aom_highbd_d117_predictor_16x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d117_predictor_16x16 aom_highbd_d117_predictor_16x16_c
+
+void aom_highbd_d117_predictor_16x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d117_predictor_16x32 aom_highbd_d117_predictor_16x32_c
+
+void aom_highbd_d117_predictor_16x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d117_predictor_16x8 aom_highbd_d117_predictor_16x8_c
+
+void aom_highbd_d117_predictor_2x2_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d117_predictor_2x2 aom_highbd_d117_predictor_2x2_c
+
+void aom_highbd_d117_predictor_32x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d117_predictor_32x16 aom_highbd_d117_predictor_32x16_c
+
+void aom_highbd_d117_predictor_32x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d117_predictor_32x32 aom_highbd_d117_predictor_32x32_c
+
+void aom_highbd_d117_predictor_4x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d117_predictor_4x4 aom_highbd_d117_predictor_4x4_c
+
+void aom_highbd_d117_predictor_4x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d117_predictor_4x8 aom_highbd_d117_predictor_4x8_c
+
+void aom_highbd_d117_predictor_8x16_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d117_predictor_8x16 aom_highbd_d117_predictor_8x16_c
+
+void aom_highbd_d117_predictor_8x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d117_predictor_8x4 aom_highbd_d117_predictor_8x4_c
+
+void aom_highbd_d117_predictor_8x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d117_predictor_8x8 aom_highbd_d117_predictor_8x8_c
+
+void aom_highbd_d135_predictor_16x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d135_predictor_16x16 aom_highbd_d135_predictor_16x16_c
+
+void aom_highbd_d135_predictor_16x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d135_predictor_16x32 aom_highbd_d135_predictor_16x32_c
+
+void aom_highbd_d135_predictor_16x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d135_predictor_16x8 aom_highbd_d135_predictor_16x8_c
+
+void aom_highbd_d135_predictor_2x2_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d135_predictor_2x2 aom_highbd_d135_predictor_2x2_c
+
+void aom_highbd_d135_predictor_32x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d135_predictor_32x16 aom_highbd_d135_predictor_32x16_c
+
+void aom_highbd_d135_predictor_32x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d135_predictor_32x32 aom_highbd_d135_predictor_32x32_c
+
+void aom_highbd_d135_predictor_4x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d135_predictor_4x4 aom_highbd_d135_predictor_4x4_c
+
+void aom_highbd_d135_predictor_4x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d135_predictor_4x8 aom_highbd_d135_predictor_4x8_c
+
+void aom_highbd_d135_predictor_8x16_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d135_predictor_8x16 aom_highbd_d135_predictor_8x16_c
+
+void aom_highbd_d135_predictor_8x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d135_predictor_8x4 aom_highbd_d135_predictor_8x4_c
+
+void aom_highbd_d135_predictor_8x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d135_predictor_8x8 aom_highbd_d135_predictor_8x8_c
+
+void aom_highbd_d153_predictor_16x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d153_predictor_16x16 aom_highbd_d153_predictor_16x16_c
+
+void aom_highbd_d153_predictor_16x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d153_predictor_16x32 aom_highbd_d153_predictor_16x32_c
+
+void aom_highbd_d153_predictor_16x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d153_predictor_16x8 aom_highbd_d153_predictor_16x8_c
+
+void aom_highbd_d153_predictor_2x2_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d153_predictor_2x2 aom_highbd_d153_predictor_2x2_c
+
+void aom_highbd_d153_predictor_32x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d153_predictor_32x16 aom_highbd_d153_predictor_32x16_c
+
+void aom_highbd_d153_predictor_32x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d153_predictor_32x32 aom_highbd_d153_predictor_32x32_c
+
+void aom_highbd_d153_predictor_4x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d153_predictor_4x4 aom_highbd_d153_predictor_4x4_c
+
+void aom_highbd_d153_predictor_4x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d153_predictor_4x8 aom_highbd_d153_predictor_4x8_c
+
+void aom_highbd_d153_predictor_8x16_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d153_predictor_8x16 aom_highbd_d153_predictor_8x16_c
+
+void aom_highbd_d153_predictor_8x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d153_predictor_8x4 aom_highbd_d153_predictor_8x4_c
+
+void aom_highbd_d153_predictor_8x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d153_predictor_8x8 aom_highbd_d153_predictor_8x8_c
+
+void aom_highbd_d207e_predictor_16x16_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_d207e_predictor_16x16 aom_highbd_d207e_predictor_16x16_c
+
+void aom_highbd_d207e_predictor_16x32_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_d207e_predictor_16x32 aom_highbd_d207e_predictor_16x32_c
+
+void aom_highbd_d207e_predictor_16x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d207e_predictor_16x8 aom_highbd_d207e_predictor_16x8_c
+
+void aom_highbd_d207e_predictor_2x2_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d207e_predictor_2x2 aom_highbd_d207e_predictor_2x2_c
+
+void aom_highbd_d207e_predictor_32x16_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_d207e_predictor_32x16 aom_highbd_d207e_predictor_32x16_c
+
+void aom_highbd_d207e_predictor_32x32_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_d207e_predictor_32x32 aom_highbd_d207e_predictor_32x32_c
+
+void aom_highbd_d207e_predictor_4x4_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d207e_predictor_4x4 aom_highbd_d207e_predictor_4x4_c
+
+void aom_highbd_d207e_predictor_4x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d207e_predictor_4x8 aom_highbd_d207e_predictor_4x8_c
+
+void aom_highbd_d207e_predictor_8x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d207e_predictor_8x16 aom_highbd_d207e_predictor_8x16_c
+
+void aom_highbd_d207e_predictor_8x4_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d207e_predictor_8x4 aom_highbd_d207e_predictor_8x4_c
+
+void aom_highbd_d207e_predictor_8x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d207e_predictor_8x8 aom_highbd_d207e_predictor_8x8_c
+
+void aom_highbd_d45e_predictor_16x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d45e_predictor_16x16 aom_highbd_d45e_predictor_16x16_c
+
+void aom_highbd_d45e_predictor_16x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d45e_predictor_16x32 aom_highbd_d45e_predictor_16x32_c
+
+void aom_highbd_d45e_predictor_16x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d45e_predictor_16x8 aom_highbd_d45e_predictor_16x8_c
+
+void aom_highbd_d45e_predictor_2x2_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d45e_predictor_2x2 aom_highbd_d45e_predictor_2x2_c
+
+void aom_highbd_d45e_predictor_32x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d45e_predictor_32x16 aom_highbd_d45e_predictor_32x16_c
+
+void aom_highbd_d45e_predictor_32x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d45e_predictor_32x32 aom_highbd_d45e_predictor_32x32_c
+
+void aom_highbd_d45e_predictor_4x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d45e_predictor_4x4 aom_highbd_d45e_predictor_4x4_c
+
+void aom_highbd_d45e_predictor_4x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d45e_predictor_4x8 aom_highbd_d45e_predictor_4x8_c
+
+void aom_highbd_d45e_predictor_8x16_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d45e_predictor_8x16 aom_highbd_d45e_predictor_8x16_c
+
+void aom_highbd_d45e_predictor_8x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d45e_predictor_8x4 aom_highbd_d45e_predictor_8x4_c
+
+void aom_highbd_d45e_predictor_8x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d45e_predictor_8x8 aom_highbd_d45e_predictor_8x8_c
+
+void aom_highbd_d63e_predictor_16x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d63e_predictor_16x16 aom_highbd_d63e_predictor_16x16_c
+
+void aom_highbd_d63e_predictor_16x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d63e_predictor_16x32 aom_highbd_d63e_predictor_16x32_c
+
+void aom_highbd_d63e_predictor_16x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d63e_predictor_16x8 aom_highbd_d63e_predictor_16x8_c
+
+void aom_highbd_d63e_predictor_2x2_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d63e_predictor_2x2 aom_highbd_d63e_predictor_2x2_c
+
+void aom_highbd_d63e_predictor_32x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d63e_predictor_32x16 aom_highbd_d63e_predictor_32x16_c
+
+void aom_highbd_d63e_predictor_32x32_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_d63e_predictor_32x32 aom_highbd_d63e_predictor_32x32_c
+
+void aom_highbd_d63e_predictor_4x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d63e_predictor_4x4 aom_highbd_d63e_predictor_4x4_c
+
+void aom_highbd_d63e_predictor_4x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d63e_predictor_4x8 aom_highbd_d63e_predictor_4x8_c
+
+void aom_highbd_d63e_predictor_8x16_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_d63e_predictor_8x16 aom_highbd_d63e_predictor_8x16_c
+
+void aom_highbd_d63e_predictor_8x4_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d63e_predictor_8x4 aom_highbd_d63e_predictor_8x4_c
+
+void aom_highbd_d63e_predictor_8x8_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_d63e_predictor_8x8 aom_highbd_d63e_predictor_8x8_c
+
+void aom_highbd_dc_128_predictor_16x16_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_128_predictor_16x16 aom_highbd_dc_128_predictor_16x16_c
+
+void aom_highbd_dc_128_predictor_16x32_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_128_predictor_16x32 aom_highbd_dc_128_predictor_16x32_c
+
+void aom_highbd_dc_128_predictor_16x8_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_128_predictor_16x8 aom_highbd_dc_128_predictor_16x8_c
+
+void aom_highbd_dc_128_predictor_2x2_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_128_predictor_2x2 aom_highbd_dc_128_predictor_2x2_c
+
+void aom_highbd_dc_128_predictor_32x16_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_128_predictor_32x16 aom_highbd_dc_128_predictor_32x16_c
+
+void aom_highbd_dc_128_predictor_32x32_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_128_predictor_32x32 aom_highbd_dc_128_predictor_32x32_c
+
+void aom_highbd_dc_128_predictor_4x4_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_128_predictor_4x4 aom_highbd_dc_128_predictor_4x4_c
+
+void aom_highbd_dc_128_predictor_4x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_128_predictor_4x8 aom_highbd_dc_128_predictor_4x8_c
+
+void aom_highbd_dc_128_predictor_8x16_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_128_predictor_8x16 aom_highbd_dc_128_predictor_8x16_c
+
+void aom_highbd_dc_128_predictor_8x4_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_128_predictor_8x4 aom_highbd_dc_128_predictor_8x4_c
+
+void aom_highbd_dc_128_predictor_8x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_128_predictor_8x8 aom_highbd_dc_128_predictor_8x8_c
+
+void aom_highbd_dc_left_predictor_16x16_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_dc_left_predictor_16x16 aom_highbd_dc_left_predictor_16x16_c
+
+void aom_highbd_dc_left_predictor_16x32_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_dc_left_predictor_16x32 aom_highbd_dc_left_predictor_16x32_c
+
+void aom_highbd_dc_left_predictor_16x8_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_left_predictor_16x8 aom_highbd_dc_left_predictor_16x8_c
+
+void aom_highbd_dc_left_predictor_2x2_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_left_predictor_2x2 aom_highbd_dc_left_predictor_2x2_c
+
+void aom_highbd_dc_left_predictor_32x16_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_dc_left_predictor_32x16 aom_highbd_dc_left_predictor_32x16_c
+
+void aom_highbd_dc_left_predictor_32x32_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_dc_left_predictor_32x32 aom_highbd_dc_left_predictor_32x32_c
+
+void aom_highbd_dc_left_predictor_4x4_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_left_predictor_4x4 aom_highbd_dc_left_predictor_4x4_c
+
+void aom_highbd_dc_left_predictor_4x8_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_left_predictor_4x8 aom_highbd_dc_left_predictor_4x8_c
+
+void aom_highbd_dc_left_predictor_8x16_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_left_predictor_8x16 aom_highbd_dc_left_predictor_8x16_c
+
+void aom_highbd_dc_left_predictor_8x4_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_left_predictor_8x4 aom_highbd_dc_left_predictor_8x4_c
+
+void aom_highbd_dc_left_predictor_8x8_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_left_predictor_8x8 aom_highbd_dc_left_predictor_8x8_c
+
+void aom_highbd_dc_predictor_16x16_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_dc_predictor_16x16 aom_highbd_dc_predictor_16x16_c
+
+void aom_highbd_dc_predictor_16x32_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_dc_predictor_16x32 aom_highbd_dc_predictor_16x32_c
+
+void aom_highbd_dc_predictor_16x8_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_dc_predictor_16x8 aom_highbd_dc_predictor_16x8_c
+
+void aom_highbd_dc_predictor_2x2_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_dc_predictor_2x2 aom_highbd_dc_predictor_2x2_c
+
+void aom_highbd_dc_predictor_32x16_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_dc_predictor_32x16 aom_highbd_dc_predictor_32x16_c
+
+void aom_highbd_dc_predictor_32x32_c(uint16_t* dst,
+                                     ptrdiff_t y_stride,
+                                     const uint16_t* above,
+                                     const uint16_t* left,
+                                     int bd);
+#define aom_highbd_dc_predictor_32x32 aom_highbd_dc_predictor_32x32_c
+
+void aom_highbd_dc_predictor_4x4_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_dc_predictor_4x4 aom_highbd_dc_predictor_4x4_c
+
+void aom_highbd_dc_predictor_4x8_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_dc_predictor_4x8 aom_highbd_dc_predictor_4x8_c
+
+void aom_highbd_dc_predictor_8x16_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_dc_predictor_8x16 aom_highbd_dc_predictor_8x16_c
+
+void aom_highbd_dc_predictor_8x4_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_dc_predictor_8x4 aom_highbd_dc_predictor_8x4_c
+
+void aom_highbd_dc_predictor_8x8_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_dc_predictor_8x8 aom_highbd_dc_predictor_8x8_c
+
+void aom_highbd_dc_top_predictor_16x16_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_top_predictor_16x16 aom_highbd_dc_top_predictor_16x16_c
+
+void aom_highbd_dc_top_predictor_16x32_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_top_predictor_16x32 aom_highbd_dc_top_predictor_16x32_c
+
+void aom_highbd_dc_top_predictor_16x8_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_top_predictor_16x8 aom_highbd_dc_top_predictor_16x8_c
+
+void aom_highbd_dc_top_predictor_2x2_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_top_predictor_2x2 aom_highbd_dc_top_predictor_2x2_c
+
+void aom_highbd_dc_top_predictor_32x16_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_top_predictor_32x16 aom_highbd_dc_top_predictor_32x16_c
+
+void aom_highbd_dc_top_predictor_32x32_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_dc_top_predictor_32x32 aom_highbd_dc_top_predictor_32x32_c
+
+void aom_highbd_dc_top_predictor_4x4_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_top_predictor_4x4 aom_highbd_dc_top_predictor_4x4_c
+
+void aom_highbd_dc_top_predictor_4x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_top_predictor_4x8 aom_highbd_dc_top_predictor_4x8_c
+
+void aom_highbd_dc_top_predictor_8x16_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_dc_top_predictor_8x16 aom_highbd_dc_top_predictor_8x16_c
+
+void aom_highbd_dc_top_predictor_8x4_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_top_predictor_8x4 aom_highbd_dc_top_predictor_8x4_c
+
+void aom_highbd_dc_top_predictor_8x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_dc_top_predictor_8x8 aom_highbd_dc_top_predictor_8x8_c
+
+void aom_highbd_h_predictor_16x16_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_h_predictor_16x16 aom_highbd_h_predictor_16x16_c
+
+void aom_highbd_h_predictor_16x32_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_h_predictor_16x32 aom_highbd_h_predictor_16x32_c
+
+void aom_highbd_h_predictor_16x8_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_h_predictor_16x8 aom_highbd_h_predictor_16x8_c
+
+void aom_highbd_h_predictor_2x2_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_h_predictor_2x2 aom_highbd_h_predictor_2x2_c
+
+void aom_highbd_h_predictor_32x16_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_h_predictor_32x16 aom_highbd_h_predictor_32x16_c
+
+void aom_highbd_h_predictor_32x32_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_h_predictor_32x32 aom_highbd_h_predictor_32x32_c
+
+void aom_highbd_h_predictor_4x4_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_h_predictor_4x4 aom_highbd_h_predictor_4x4_c
+
+void aom_highbd_h_predictor_4x8_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_h_predictor_4x8 aom_highbd_h_predictor_4x8_c
+
+void aom_highbd_h_predictor_8x16_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_h_predictor_8x16 aom_highbd_h_predictor_8x16_c
+
+void aom_highbd_h_predictor_8x4_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_h_predictor_8x4 aom_highbd_h_predictor_8x4_c
+
+void aom_highbd_h_predictor_8x8_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_h_predictor_8x8 aom_highbd_h_predictor_8x8_c
+
+void aom_highbd_iwht4x4_16_add_c(const tran_low_t* input,
+                                 uint8_t* dest,
+                                 int dest_stride,
+                                 int bd);
+#define aom_highbd_iwht4x4_16_add aom_highbd_iwht4x4_16_add_c
+
+void aom_highbd_iwht4x4_1_add_c(const tran_low_t* input,
+                                uint8_t* dest,
+                                int dest_stride,
+                                int bd);
+#define aom_highbd_iwht4x4_1_add aom_highbd_iwht4x4_1_add_c
+
+void aom_highbd_lpf_horizontal_4_c(uint16_t* s,
+                                   int pitch,
+                                   const uint8_t* blimit,
+                                   const uint8_t* limit,
+                                   const uint8_t* thresh,
+                                   int bd);
+#define aom_highbd_lpf_horizontal_4 aom_highbd_lpf_horizontal_4_c
+
+void aom_highbd_lpf_horizontal_4_dual_c(uint16_t* s,
+                                        int pitch,
+                                        const uint8_t* blimit0,
+                                        const uint8_t* limit0,
+                                        const uint8_t* thresh0,
+                                        const uint8_t* blimit1,
+                                        const uint8_t* limit1,
+                                        const uint8_t* thresh1,
+                                        int bd);
+#define aom_highbd_lpf_horizontal_4_dual aom_highbd_lpf_horizontal_4_dual_c
+
+void aom_highbd_lpf_horizontal_8_c(uint16_t* s,
+                                   int pitch,
+                                   const uint8_t* blimit,
+                                   const uint8_t* limit,
+                                   const uint8_t* thresh,
+                                   int bd);
+#define aom_highbd_lpf_horizontal_8 aom_highbd_lpf_horizontal_8_c
+
+void aom_highbd_lpf_horizontal_8_dual_c(uint16_t* s,
+                                        int pitch,
+                                        const uint8_t* blimit0,
+                                        const uint8_t* limit0,
+                                        const uint8_t* thresh0,
+                                        const uint8_t* blimit1,
+                                        const uint8_t* limit1,
+                                        const uint8_t* thresh1,
+                                        int bd);
+#define aom_highbd_lpf_horizontal_8_dual aom_highbd_lpf_horizontal_8_dual_c
+
+void aom_highbd_lpf_horizontal_edge_16_c(uint16_t* s,
+                                         int pitch,
+                                         const uint8_t* blimit,
+                                         const uint8_t* limit,
+                                         const uint8_t* thresh,
+                                         int bd);
+#define aom_highbd_lpf_horizontal_edge_16 aom_highbd_lpf_horizontal_edge_16_c
+
+void aom_highbd_lpf_horizontal_edge_8_c(uint16_t* s,
+                                        int pitch,
+                                        const uint8_t* blimit,
+                                        const uint8_t* limit,
+                                        const uint8_t* thresh,
+                                        int bd);
+#define aom_highbd_lpf_horizontal_edge_8 aom_highbd_lpf_horizontal_edge_8_c
+
+void aom_highbd_lpf_vertical_16_c(uint16_t* s,
+                                  int pitch,
+                                  const uint8_t* blimit,
+                                  const uint8_t* limit,
+                                  const uint8_t* thresh,
+                                  int bd);
+#define aom_highbd_lpf_vertical_16 aom_highbd_lpf_vertical_16_c
+
+void aom_highbd_lpf_vertical_16_dual_c(uint16_t* s,
+                                       int pitch,
+                                       const uint8_t* blimit,
+                                       const uint8_t* limit,
+                                       const uint8_t* thresh,
+                                       int bd);
+#define aom_highbd_lpf_vertical_16_dual aom_highbd_lpf_vertical_16_dual_c
+
+void aom_highbd_lpf_vertical_4_c(uint16_t* s,
+                                 int pitch,
+                                 const uint8_t* blimit,
+                                 const uint8_t* limit,
+                                 const uint8_t* thresh,
+                                 int bd);
+#define aom_highbd_lpf_vertical_4 aom_highbd_lpf_vertical_4_c
+
+void aom_highbd_lpf_vertical_4_dual_c(uint16_t* s,
+                                      int pitch,
+                                      const uint8_t* blimit0,
+                                      const uint8_t* limit0,
+                                      const uint8_t* thresh0,
+                                      const uint8_t* blimit1,
+                                      const uint8_t* limit1,
+                                      const uint8_t* thresh1,
+                                      int bd);
+#define aom_highbd_lpf_vertical_4_dual aom_highbd_lpf_vertical_4_dual_c
+
+void aom_highbd_lpf_vertical_8_c(uint16_t* s,
+                                 int pitch,
+                                 const uint8_t* blimit,
+                                 const uint8_t* limit,
+                                 const uint8_t* thresh,
+                                 int bd);
+#define aom_highbd_lpf_vertical_8 aom_highbd_lpf_vertical_8_c
+
+void aom_highbd_lpf_vertical_8_dual_c(uint16_t* s,
+                                      int pitch,
+                                      const uint8_t* blimit0,
+                                      const uint8_t* limit0,
+                                      const uint8_t* thresh0,
+                                      const uint8_t* blimit1,
+                                      const uint8_t* limit1,
+                                      const uint8_t* thresh1,
+                                      int bd);
+#define aom_highbd_lpf_vertical_8_dual aom_highbd_lpf_vertical_8_dual_c
+
+void aom_highbd_paeth_predictor_16x16_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_paeth_predictor_16x16 aom_highbd_paeth_predictor_16x16_c
+
+void aom_highbd_paeth_predictor_16x32_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_paeth_predictor_16x32 aom_highbd_paeth_predictor_16x32_c
+
+void aom_highbd_paeth_predictor_16x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_paeth_predictor_16x8 aom_highbd_paeth_predictor_16x8_c
+
+void aom_highbd_paeth_predictor_2x2_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_paeth_predictor_2x2 aom_highbd_paeth_predictor_2x2_c
+
+void aom_highbd_paeth_predictor_32x16_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_paeth_predictor_32x16 aom_highbd_paeth_predictor_32x16_c
+
+void aom_highbd_paeth_predictor_32x32_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_paeth_predictor_32x32 aom_highbd_paeth_predictor_32x32_c
+
+void aom_highbd_paeth_predictor_4x4_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_paeth_predictor_4x4 aom_highbd_paeth_predictor_4x4_c
+
+void aom_highbd_paeth_predictor_4x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_paeth_predictor_4x8 aom_highbd_paeth_predictor_4x8_c
+
+void aom_highbd_paeth_predictor_8x16_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_paeth_predictor_8x16 aom_highbd_paeth_predictor_8x16_c
+
+void aom_highbd_paeth_predictor_8x4_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_paeth_predictor_8x4 aom_highbd_paeth_predictor_8x4_c
+
+void aom_highbd_paeth_predictor_8x8_c(uint16_t* dst,
+                                      ptrdiff_t y_stride,
+                                      const uint16_t* above,
+                                      const uint16_t* left,
+                                      int bd);
+#define aom_highbd_paeth_predictor_8x8 aom_highbd_paeth_predictor_8x8_c
+
+void aom_highbd_smooth_h_predictor_16x16_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_h_predictor_16x16 \
+  aom_highbd_smooth_h_predictor_16x16_c
+
+void aom_highbd_smooth_h_predictor_16x32_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_h_predictor_16x32 \
+  aom_highbd_smooth_h_predictor_16x32_c
+
+void aom_highbd_smooth_h_predictor_16x8_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_smooth_h_predictor_16x8 aom_highbd_smooth_h_predictor_16x8_c
+
+void aom_highbd_smooth_h_predictor_2x2_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_h_predictor_2x2 aom_highbd_smooth_h_predictor_2x2_c
+
+void aom_highbd_smooth_h_predictor_32x16_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_h_predictor_32x16 \
+  aom_highbd_smooth_h_predictor_32x16_c
+
+void aom_highbd_smooth_h_predictor_32x32_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_h_predictor_32x32 \
+  aom_highbd_smooth_h_predictor_32x32_c
+
+void aom_highbd_smooth_h_predictor_4x4_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_h_predictor_4x4 aom_highbd_smooth_h_predictor_4x4_c
+
+void aom_highbd_smooth_h_predictor_4x8_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_h_predictor_4x8 aom_highbd_smooth_h_predictor_4x8_c
+
+void aom_highbd_smooth_h_predictor_8x16_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_smooth_h_predictor_8x16 aom_highbd_smooth_h_predictor_8x16_c
+
+void aom_highbd_smooth_h_predictor_8x4_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_h_predictor_8x4 aom_highbd_smooth_h_predictor_8x4_c
+
+void aom_highbd_smooth_h_predictor_8x8_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_h_predictor_8x8 aom_highbd_smooth_h_predictor_8x8_c
+
+void aom_highbd_smooth_predictor_16x16_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_predictor_16x16 aom_highbd_smooth_predictor_16x16_c
+
+void aom_highbd_smooth_predictor_16x32_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_predictor_16x32 aom_highbd_smooth_predictor_16x32_c
+
+void aom_highbd_smooth_predictor_16x8_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_smooth_predictor_16x8 aom_highbd_smooth_predictor_16x8_c
+
+void aom_highbd_smooth_predictor_2x2_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_smooth_predictor_2x2 aom_highbd_smooth_predictor_2x2_c
+
+void aom_highbd_smooth_predictor_32x16_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_predictor_32x16 aom_highbd_smooth_predictor_32x16_c
+
+void aom_highbd_smooth_predictor_32x32_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_predictor_32x32 aom_highbd_smooth_predictor_32x32_c
+
+void aom_highbd_smooth_predictor_4x4_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_smooth_predictor_4x4 aom_highbd_smooth_predictor_4x4_c
+
+void aom_highbd_smooth_predictor_4x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_smooth_predictor_4x8 aom_highbd_smooth_predictor_4x8_c
+
+void aom_highbd_smooth_predictor_8x16_c(uint16_t* dst,
+                                        ptrdiff_t y_stride,
+                                        const uint16_t* above,
+                                        const uint16_t* left,
+                                        int bd);
+#define aom_highbd_smooth_predictor_8x16 aom_highbd_smooth_predictor_8x16_c
+
+void aom_highbd_smooth_predictor_8x4_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_smooth_predictor_8x4 aom_highbd_smooth_predictor_8x4_c
+
+void aom_highbd_smooth_predictor_8x8_c(uint16_t* dst,
+                                       ptrdiff_t y_stride,
+                                       const uint16_t* above,
+                                       const uint16_t* left,
+                                       int bd);
+#define aom_highbd_smooth_predictor_8x8 aom_highbd_smooth_predictor_8x8_c
+
+void aom_highbd_smooth_v_predictor_16x16_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_v_predictor_16x16 \
+  aom_highbd_smooth_v_predictor_16x16_c
+
+void aom_highbd_smooth_v_predictor_16x32_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_v_predictor_16x32 \
+  aom_highbd_smooth_v_predictor_16x32_c
+
+void aom_highbd_smooth_v_predictor_16x8_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_smooth_v_predictor_16x8 aom_highbd_smooth_v_predictor_16x8_c
+
+void aom_highbd_smooth_v_predictor_2x2_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_v_predictor_2x2 aom_highbd_smooth_v_predictor_2x2_c
+
+void aom_highbd_smooth_v_predictor_32x16_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_v_predictor_32x16 \
+  aom_highbd_smooth_v_predictor_32x16_c
+
+void aom_highbd_smooth_v_predictor_32x32_c(uint16_t* dst,
+                                           ptrdiff_t y_stride,
+                                           const uint16_t* above,
+                                           const uint16_t* left,
+                                           int bd);
+#define aom_highbd_smooth_v_predictor_32x32 \
+  aom_highbd_smooth_v_predictor_32x32_c
+
+void aom_highbd_smooth_v_predictor_4x4_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_v_predictor_4x4 aom_highbd_smooth_v_predictor_4x4_c
+
+void aom_highbd_smooth_v_predictor_4x8_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_v_predictor_4x8 aom_highbd_smooth_v_predictor_4x8_c
+
+void aom_highbd_smooth_v_predictor_8x16_c(uint16_t* dst,
+                                          ptrdiff_t y_stride,
+                                          const uint16_t* above,
+                                          const uint16_t* left,
+                                          int bd);
+#define aom_highbd_smooth_v_predictor_8x16 aom_highbd_smooth_v_predictor_8x16_c
+
+void aom_highbd_smooth_v_predictor_8x4_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_v_predictor_8x4 aom_highbd_smooth_v_predictor_8x4_c
+
+void aom_highbd_smooth_v_predictor_8x8_c(uint16_t* dst,
+                                         ptrdiff_t y_stride,
+                                         const uint16_t* above,
+                                         const uint16_t* left,
+                                         int bd);
+#define aom_highbd_smooth_v_predictor_8x8 aom_highbd_smooth_v_predictor_8x8_c
+
+void aom_highbd_v_predictor_16x16_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_v_predictor_16x16 aom_highbd_v_predictor_16x16_c
+
+void aom_highbd_v_predictor_16x32_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_v_predictor_16x32 aom_highbd_v_predictor_16x32_c
+
+void aom_highbd_v_predictor_16x8_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_v_predictor_16x8 aom_highbd_v_predictor_16x8_c
+
+void aom_highbd_v_predictor_2x2_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_v_predictor_2x2 aom_highbd_v_predictor_2x2_c
+
+void aom_highbd_v_predictor_32x16_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_v_predictor_32x16 aom_highbd_v_predictor_32x16_c
+
+void aom_highbd_v_predictor_32x32_c(uint16_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint16_t* above,
+                                    const uint16_t* left,
+                                    int bd);
+#define aom_highbd_v_predictor_32x32 aom_highbd_v_predictor_32x32_c
+
+void aom_highbd_v_predictor_4x4_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_v_predictor_4x4 aom_highbd_v_predictor_4x4_c
+
+void aom_highbd_v_predictor_4x8_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_v_predictor_4x8 aom_highbd_v_predictor_4x8_c
+
+void aom_highbd_v_predictor_8x16_c(uint16_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint16_t* above,
+                                   const uint16_t* left,
+                                   int bd);
+#define aom_highbd_v_predictor_8x16 aom_highbd_v_predictor_8x16_c
+
+void aom_highbd_v_predictor_8x4_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_v_predictor_8x4 aom_highbd_v_predictor_8x4_c
+
+void aom_highbd_v_predictor_8x8_c(uint16_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint16_t* above,
+                                  const uint16_t* left,
+                                  int bd);
+#define aom_highbd_v_predictor_8x8 aom_highbd_v_predictor_8x8_c
+
+void aom_idct16x16_10_add_c(const tran_low_t* input,
+                            uint8_t* dest,
+                            int dest_stride);
+#define aom_idct16x16_10_add aom_idct16x16_10_add_c
+
+void aom_idct16x16_1_add_c(const tran_low_t* input,
+                           uint8_t* dest,
+                           int dest_stride);
+#define aom_idct16x16_1_add aom_idct16x16_1_add_c
+
+void aom_idct16x16_256_add_c(const tran_low_t* input,
+                             uint8_t* dest,
+                             int dest_stride);
+#define aom_idct16x16_256_add aom_idct16x16_256_add_c
+
+void aom_idct16x16_38_add_c(const tran_low_t* input,
+                            uint8_t* dest,
+                            int dest_stride);
+#define aom_idct16x16_38_add aom_idct16x16_38_add_c
+
+void aom_idct32x32_1024_add_c(const tran_low_t* input,
+                              uint8_t* dest,
+                              int dest_stride);
+#define aom_idct32x32_1024_add aom_idct32x32_1024_add_c
+
+void aom_idct32x32_135_add_c(const tran_low_t* input,
+                             uint8_t* dest,
+                             int dest_stride);
+#define aom_idct32x32_135_add aom_idct32x32_135_add_c
+
+void aom_idct32x32_1_add_c(const tran_low_t* input,
+                           uint8_t* dest,
+                           int dest_stride);
+#define aom_idct32x32_1_add aom_idct32x32_1_add_c
+
+void aom_idct32x32_34_add_c(const tran_low_t* input,
+                            uint8_t* dest,
+                            int dest_stride);
+#define aom_idct32x32_34_add aom_idct32x32_34_add_c
+
+void aom_idct4x4_16_add_c(const tran_low_t* input,
+                          uint8_t* dest,
+                          int dest_stride);
+#define aom_idct4x4_16_add aom_idct4x4_16_add_c
+
+void aom_idct4x4_1_add_c(const tran_low_t* input,
+                         uint8_t* dest,
+                         int dest_stride);
+#define aom_idct4x4_1_add aom_idct4x4_1_add_c
+
+void aom_idct8x8_12_add_c(const tran_low_t* input,
+                          uint8_t* dest,
+                          int dest_stride);
+#define aom_idct8x8_12_add aom_idct8x8_12_add_c
+
+void aom_idct8x8_1_add_c(const tran_low_t* input,
+                         uint8_t* dest,
+                         int dest_stride);
+#define aom_idct8x8_1_add aom_idct8x8_1_add_c
+
+void aom_idct8x8_64_add_c(const tran_low_t* input,
+                          uint8_t* dest,
+                          int dest_stride);
+#define aom_idct8x8_64_add aom_idct8x8_64_add_c
+
+void aom_iwht4x4_16_add_c(const tran_low_t* input,
+                          uint8_t* dest,
+                          int dest_stride);
+#define aom_iwht4x4_16_add aom_iwht4x4_16_add_c
+
+void aom_iwht4x4_1_add_c(const tran_low_t* input,
+                         uint8_t* dest,
+                         int dest_stride);
+#define aom_iwht4x4_1_add aom_iwht4x4_1_add_c
+
+void aom_lpf_horizontal_4_c(uint8_t* s,
+                            int pitch,
+                            const uint8_t* blimit,
+                            const uint8_t* limit,
+                            const uint8_t* thresh);
+#define aom_lpf_horizontal_4 aom_lpf_horizontal_4_c
+
+void aom_lpf_horizontal_4_dual_c(uint8_t* s,
+                                 int pitch,
+                                 const uint8_t* blimit0,
+                                 const uint8_t* limit0,
+                                 const uint8_t* thresh0,
+                                 const uint8_t* blimit1,
+                                 const uint8_t* limit1,
+                                 const uint8_t* thresh1);
+#define aom_lpf_horizontal_4_dual aom_lpf_horizontal_4_dual_c
+
+void aom_lpf_horizontal_8_c(uint8_t* s,
+                            int pitch,
+                            const uint8_t* blimit,
+                            const uint8_t* limit,
+                            const uint8_t* thresh);
+#define aom_lpf_horizontal_8 aom_lpf_horizontal_8_c
+
+void aom_lpf_horizontal_8_dual_c(uint8_t* s,
+                                 int pitch,
+                                 const uint8_t* blimit0,
+                                 const uint8_t* limit0,
+                                 const uint8_t* thresh0,
+                                 const uint8_t* blimit1,
+                                 const uint8_t* limit1,
+                                 const uint8_t* thresh1);
+#define aom_lpf_horizontal_8_dual aom_lpf_horizontal_8_dual_c
+
+void aom_lpf_horizontal_edge_16_c(uint8_t* s,
+                                  int pitch,
+                                  const uint8_t* blimit,
+                                  const uint8_t* limit,
+                                  const uint8_t* thresh);
+#define aom_lpf_horizontal_edge_16 aom_lpf_horizontal_edge_16_c
+
+void aom_lpf_horizontal_edge_8_c(uint8_t* s,
+                                 int pitch,
+                                 const uint8_t* blimit,
+                                 const uint8_t* limit,
+                                 const uint8_t* thresh);
+#define aom_lpf_horizontal_edge_8 aom_lpf_horizontal_edge_8_c
+
+void aom_lpf_vertical_16_c(uint8_t* s,
+                           int pitch,
+                           const uint8_t* blimit,
+                           const uint8_t* limit,
+                           const uint8_t* thresh);
+#define aom_lpf_vertical_16 aom_lpf_vertical_16_c
+
+void aom_lpf_vertical_16_dual_c(uint8_t* s,
+                                int pitch,
+                                const uint8_t* blimit,
+                                const uint8_t* limit,
+                                const uint8_t* thresh);
+#define aom_lpf_vertical_16_dual aom_lpf_vertical_16_dual_c
+
+void aom_lpf_vertical_4_c(uint8_t* s,
+                          int pitch,
+                          const uint8_t* blimit,
+                          const uint8_t* limit,
+                          const uint8_t* thresh);
+#define aom_lpf_vertical_4 aom_lpf_vertical_4_c
+
+void aom_lpf_vertical_4_dual_c(uint8_t* s,
+                               int pitch,
+                               const uint8_t* blimit0,
+                               const uint8_t* limit0,
+                               const uint8_t* thresh0,
+                               const uint8_t* blimit1,
+                               const uint8_t* limit1,
+                               const uint8_t* thresh1);
+#define aom_lpf_vertical_4_dual aom_lpf_vertical_4_dual_c
+
+void aom_lpf_vertical_8_c(uint8_t* s,
+                          int pitch,
+                          const uint8_t* blimit,
+                          const uint8_t* limit,
+                          const uint8_t* thresh);
+#define aom_lpf_vertical_8 aom_lpf_vertical_8_c
+
+void aom_lpf_vertical_8_dual_c(uint8_t* s,
+                               int pitch,
+                               const uint8_t* blimit0,
+                               const uint8_t* limit0,
+                               const uint8_t* thresh0,
+                               const uint8_t* blimit1,
+                               const uint8_t* limit1,
+                               const uint8_t* thresh1);
+#define aom_lpf_vertical_8_dual aom_lpf_vertical_8_dual_c
+
+void aom_paeth_predictor_16x16_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_paeth_predictor_16x16 aom_paeth_predictor_16x16_c
+
+void aom_paeth_predictor_16x32_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_paeth_predictor_16x32 aom_paeth_predictor_16x32_c
+
+void aom_paeth_predictor_16x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_paeth_predictor_16x8 aom_paeth_predictor_16x8_c
+
+void aom_paeth_predictor_2x2_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_paeth_predictor_2x2 aom_paeth_predictor_2x2_c
+
+void aom_paeth_predictor_32x16_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_paeth_predictor_32x16 aom_paeth_predictor_32x16_c
+
+void aom_paeth_predictor_32x32_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_paeth_predictor_32x32 aom_paeth_predictor_32x32_c
+
+void aom_paeth_predictor_4x4_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_paeth_predictor_4x4 aom_paeth_predictor_4x4_c
+
+void aom_paeth_predictor_4x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_paeth_predictor_4x8 aom_paeth_predictor_4x8_c
+
+void aom_paeth_predictor_8x16_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_paeth_predictor_8x16 aom_paeth_predictor_8x16_c
+
+void aom_paeth_predictor_8x4_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_paeth_predictor_8x4 aom_paeth_predictor_8x4_c
+
+void aom_paeth_predictor_8x8_c(uint8_t* dst,
+                               ptrdiff_t y_stride,
+                               const uint8_t* above,
+                               const uint8_t* left);
+#define aom_paeth_predictor_8x8 aom_paeth_predictor_8x8_c
+
+void aom_scaled_2d_c(const uint8_t* src,
+                     ptrdiff_t src_stride,
+                     uint8_t* dst,
+                     ptrdiff_t dst_stride,
+                     const int16_t* filter_x,
+                     int x_step_q4,
+                     const int16_t* filter_y,
+                     int y_step_q4,
+                     int w,
+                     int h);
+#define aom_scaled_2d aom_scaled_2d_c
+
+void aom_scaled_avg_2d_c(const uint8_t* src,
+                         ptrdiff_t src_stride,
+                         uint8_t* dst,
+                         ptrdiff_t dst_stride,
+                         const int16_t* filter_x,
+                         int x_step_q4,
+                         const int16_t* filter_y,
+                         int y_step_q4,
+                         int w,
+                         int h);
+#define aom_scaled_avg_2d aom_scaled_avg_2d_c
+
+void aom_scaled_avg_horiz_c(const uint8_t* src,
+                            ptrdiff_t src_stride,
+                            uint8_t* dst,
+                            ptrdiff_t dst_stride,
+                            const int16_t* filter_x,
+                            int x_step_q4,
+                            const int16_t* filter_y,
+                            int y_step_q4,
+                            int w,
+                            int h);
+#define aom_scaled_avg_horiz aom_scaled_avg_horiz_c
+
+void aom_scaled_avg_vert_c(const uint8_t* src,
+                           ptrdiff_t src_stride,
+                           uint8_t* dst,
+                           ptrdiff_t dst_stride,
+                           const int16_t* filter_x,
+                           int x_step_q4,
+                           const int16_t* filter_y,
+                           int y_step_q4,
+                           int w,
+                           int h);
+#define aom_scaled_avg_vert aom_scaled_avg_vert_c
+
+void aom_scaled_horiz_c(const uint8_t* src,
+                        ptrdiff_t src_stride,
+                        uint8_t* dst,
+                        ptrdiff_t dst_stride,
+                        const int16_t* filter_x,
+                        int x_step_q4,
+                        const int16_t* filter_y,
+                        int y_step_q4,
+                        int w,
+                        int h);
+#define aom_scaled_horiz aom_scaled_horiz_c
+
+void aom_scaled_vert_c(const uint8_t* src,
+                       ptrdiff_t src_stride,
+                       uint8_t* dst,
+                       ptrdiff_t dst_stride,
+                       const int16_t* filter_x,
+                       int x_step_q4,
+                       const int16_t* filter_y,
+                       int y_step_q4,
+                       int w,
+                       int h);
+#define aom_scaled_vert aom_scaled_vert_c
+
+void aom_smooth_h_predictor_16x16_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_h_predictor_16x16 aom_smooth_h_predictor_16x16_c
+
+void aom_smooth_h_predictor_16x32_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_h_predictor_16x32 aom_smooth_h_predictor_16x32_c
+
+void aom_smooth_h_predictor_16x8_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_smooth_h_predictor_16x8 aom_smooth_h_predictor_16x8_c
+
+void aom_smooth_h_predictor_2x2_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_h_predictor_2x2 aom_smooth_h_predictor_2x2_c
+
+void aom_smooth_h_predictor_32x16_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_h_predictor_32x16 aom_smooth_h_predictor_32x16_c
+
+void aom_smooth_h_predictor_32x32_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_h_predictor_32x32 aom_smooth_h_predictor_32x32_c
+
+void aom_smooth_h_predictor_4x4_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_h_predictor_4x4 aom_smooth_h_predictor_4x4_c
+
+void aom_smooth_h_predictor_4x8_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_h_predictor_4x8 aom_smooth_h_predictor_4x8_c
+
+void aom_smooth_h_predictor_8x16_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_smooth_h_predictor_8x16 aom_smooth_h_predictor_8x16_c
+
+void aom_smooth_h_predictor_8x4_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_h_predictor_8x4 aom_smooth_h_predictor_8x4_c
+
+void aom_smooth_h_predictor_8x8_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_h_predictor_8x8 aom_smooth_h_predictor_8x8_c
+
+void aom_smooth_predictor_16x16_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_predictor_16x16 aom_smooth_predictor_16x16_c
+
+void aom_smooth_predictor_16x32_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_predictor_16x32 aom_smooth_predictor_16x32_c
+
+void aom_smooth_predictor_16x8_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_smooth_predictor_16x8 aom_smooth_predictor_16x8_c
+
+void aom_smooth_predictor_2x2_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_smooth_predictor_2x2 aom_smooth_predictor_2x2_c
+
+void aom_smooth_predictor_32x16_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_predictor_32x16 aom_smooth_predictor_32x16_c
+
+void aom_smooth_predictor_32x32_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_predictor_32x32 aom_smooth_predictor_32x32_c
+
+void aom_smooth_predictor_4x4_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_smooth_predictor_4x4 aom_smooth_predictor_4x4_c
+
+void aom_smooth_predictor_4x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_smooth_predictor_4x8 aom_smooth_predictor_4x8_c
+
+void aom_smooth_predictor_8x16_c(uint8_t* dst,
+                                 ptrdiff_t y_stride,
+                                 const uint8_t* above,
+                                 const uint8_t* left);
+#define aom_smooth_predictor_8x16 aom_smooth_predictor_8x16_c
+
+void aom_smooth_predictor_8x4_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_smooth_predictor_8x4 aom_smooth_predictor_8x4_c
+
+void aom_smooth_predictor_8x8_c(uint8_t* dst,
+                                ptrdiff_t y_stride,
+                                const uint8_t* above,
+                                const uint8_t* left);
+#define aom_smooth_predictor_8x8 aom_smooth_predictor_8x8_c
+
+void aom_smooth_v_predictor_16x16_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_v_predictor_16x16 aom_smooth_v_predictor_16x16_c
+
+void aom_smooth_v_predictor_16x32_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_v_predictor_16x32 aom_smooth_v_predictor_16x32_c
+
+void aom_smooth_v_predictor_16x8_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_smooth_v_predictor_16x8 aom_smooth_v_predictor_16x8_c
+
+void aom_smooth_v_predictor_2x2_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_v_predictor_2x2 aom_smooth_v_predictor_2x2_c
+
+void aom_smooth_v_predictor_32x16_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_v_predictor_32x16 aom_smooth_v_predictor_32x16_c
+
+void aom_smooth_v_predictor_32x32_c(uint8_t* dst,
+                                    ptrdiff_t y_stride,
+                                    const uint8_t* above,
+                                    const uint8_t* left);
+#define aom_smooth_v_predictor_32x32 aom_smooth_v_predictor_32x32_c
+
+void aom_smooth_v_predictor_4x4_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_v_predictor_4x4 aom_smooth_v_predictor_4x4_c
+
+void aom_smooth_v_predictor_4x8_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_v_predictor_4x8 aom_smooth_v_predictor_4x8_c
+
+void aom_smooth_v_predictor_8x16_c(uint8_t* dst,
+                                   ptrdiff_t y_stride,
+                                   const uint8_t* above,
+                                   const uint8_t* left);
+#define aom_smooth_v_predictor_8x16 aom_smooth_v_predictor_8x16_c
+
+void aom_smooth_v_predictor_8x4_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_v_predictor_8x4 aom_smooth_v_predictor_8x4_c
+
+void aom_smooth_v_predictor_8x8_c(uint8_t* dst,
+                                  ptrdiff_t y_stride,
+                                  const uint8_t* above,
+                                  const uint8_t* left);
+#define aom_smooth_v_predictor_8x8 aom_smooth_v_predictor_8x8_c
+
+void aom_v_predictor_16x16_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_v_predictor_16x16 aom_v_predictor_16x16_c
+
+void aom_v_predictor_16x32_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_v_predictor_16x32 aom_v_predictor_16x32_c
+
+void aom_v_predictor_16x8_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_v_predictor_16x8 aom_v_predictor_16x8_c
+
+void aom_v_predictor_2x2_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_v_predictor_2x2 aom_v_predictor_2x2_c
+
+void aom_v_predictor_32x16_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_v_predictor_32x16 aom_v_predictor_32x16_c
+
+void aom_v_predictor_32x32_c(uint8_t* dst,
+                             ptrdiff_t y_stride,
+                             const uint8_t* above,
+                             const uint8_t* left);
+#define aom_v_predictor_32x32 aom_v_predictor_32x32_c
+
+void aom_v_predictor_4x4_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_v_predictor_4x4 aom_v_predictor_4x4_c
+
+void aom_v_predictor_4x8_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_v_predictor_4x8 aom_v_predictor_4x8_c
+
+void aom_v_predictor_8x16_c(uint8_t* dst,
+                            ptrdiff_t y_stride,
+                            const uint8_t* above,
+                            const uint8_t* left);
+#define aom_v_predictor_8x16 aom_v_predictor_8x16_c
+
+void aom_v_predictor_8x4_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_v_predictor_8x4 aom_v_predictor_8x4_c
+
+void aom_v_predictor_8x8_c(uint8_t* dst,
+                           ptrdiff_t y_stride,
+                           const uint8_t* above,
+                           const uint8_t* left);
+#define aom_v_predictor_8x8 aom_v_predictor_8x8_c
+
+void aom_dsp_rtcd(void);
+
+#include "aom_config.h"
+
+#ifdef RTCD_C
+static void setup_rtcd_internal(void) {}
+#endif
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif
diff --git a/third_party/libaom/source/config/linux/generic/aom_scale_rtcd.h b/third_party/libaom/source/config/linux/generic/aom_scale_rtcd.h
new file mode 100644
index 0000000..97ab3bd
--- /dev/null
+++ b/third_party/libaom/source/config/linux/generic/aom_scale_rtcd.h
@@ -0,0 +1,102 @@
+#ifndef AOM_SCALE_RTCD_H_
+#define AOM_SCALE_RTCD_H_
+
+#ifdef RTCD_C
+#define RTCD_EXTERN
+#else
+#define RTCD_EXTERN extern
+#endif
+
+struct yv12_buffer_config;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void aom_extend_frame_borders_c(struct yv12_buffer_config* ybf);
+#define aom_extend_frame_borders aom_extend_frame_borders_c
+
+void aom_extend_frame_borders_y_c(struct yv12_buffer_config* ybf);
+#define aom_extend_frame_borders_y aom_extend_frame_borders_y_c
+
+void aom_extend_frame_inner_borders_c(struct yv12_buffer_config* ybf);
+#define aom_extend_frame_inner_borders aom_extend_frame_inner_borders_c
+
+void aom_horizontal_line_2_1_scale_c(const unsigned char* source,
+                                     unsigned int source_width,
+                                     unsigned char* dest,
+                                     unsigned int dest_width);
+#define aom_horizontal_line_2_1_scale aom_horizontal_line_2_1_scale_c
+
+void aom_horizontal_line_5_3_scale_c(const unsigned char* source,
+                                     unsigned int source_width,
+                                     unsigned char* dest,
+                                     unsigned int dest_width);
+#define aom_horizontal_line_5_3_scale aom_horizontal_line_5_3_scale_c
+
+void aom_horizontal_line_5_4_scale_c(const unsigned char* source,
+                                     unsigned int source_width,
+                                     unsigned char* dest,
+                                     unsigned int dest_width);
+#define aom_horizontal_line_5_4_scale aom_horizontal_line_5_4_scale_c
+
+void aom_vertical_band_2_1_scale_c(unsigned char* source,
+                                   int src_pitch,
+                                   unsigned char* dest,
+                                   int dest_pitch,
+                                   unsigned int dest_width);
+#define aom_vertical_band_2_1_scale aom_vertical_band_2_1_scale_c
+
+void aom_vertical_band_2_1_scale_i_c(unsigned char* source,
+                                     int src_pitch,
+                                     unsigned char* dest,
+                                     int dest_pitch,
+                                     unsigned int dest_width);
+#define aom_vertical_band_2_1_scale_i aom_vertical_band_2_1_scale_i_c
+
+void aom_vertical_band_5_3_scale_c(unsigned char* source,
+                                   int src_pitch,
+                                   unsigned char* dest,
+                                   int dest_pitch,
+                                   unsigned int dest_width);
+#define aom_vertical_band_5_3_scale aom_vertical_band_5_3_scale_c
+
+void aom_vertical_band_5_4_scale_c(unsigned char* source,
+                                   int src_pitch,
+                                   unsigned char* dest,
+                                   int dest_pitch,
+                                   unsigned int dest_width);
+#define aom_vertical_band_5_4_scale aom_vertical_band_5_4_scale_c
+
+void aom_yv12_copy_frame_c(const struct yv12_buffer_config* src_bc,
+                           struct yv12_buffer_config* dst_bc);
+#define aom_yv12_copy_frame aom_yv12_copy_frame_c
+
+void aom_yv12_copy_u_c(const struct yv12_buffer_config* src_bc,
+                       struct yv12_buffer_config* dst_bc);
+#define aom_yv12_copy_u aom_yv12_copy_u_c
+
+void aom_yv12_copy_v_c(const struct yv12_buffer_config* src_bc,
+                       struct yv12_buffer_config* dst_bc);
+#define aom_yv12_copy_v aom_yv12_copy_v_c
+
+void aom_yv12_copy_y_c(const struct yv12_buffer_config* src_ybc,
+                       struct yv12_buffer_config* dst_ybc);
+#define aom_yv12_copy_y aom_yv12_copy_y_c
+
+void aom_yv12_extend_frame_borders_c(struct yv12_buffer_config* ybf);
+#define aom_yv12_extend_frame_borders aom_yv12_extend_frame_borders_c
+
+void aom_scale_rtcd(void);
+
+#include "aom_config.h"
+
+#ifdef RTCD_C
+static void setup_rtcd_internal(void) {}
+#endif
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif
diff --git a/third_party/libaom/source/config/linux/generic/av1_rtcd.h b/third_party/libaom/source/config/linux/generic/av1_rtcd.h
new file mode 100644
index 0000000..2ed4295
--- /dev/null
+++ b/third_party/libaom/source/config/linux/generic/av1_rtcd.h
@@ -0,0 +1,670 @@
+#ifndef AV1_RTCD_H_
+#define AV1_RTCD_H_
+
+#ifdef RTCD_C
+#define RTCD_EXTERN
+#else
+#define RTCD_EXTERN extern
+#endif
+
+/*
+ * AV1
+ */
+
+#include "aom/aom_integer.h"
+#include "aom_dsp/txfm_common.h"
+#include "av1/common/av1_txfm.h"
+#include "av1/common/common.h"
+#include "av1/common/convolve.h"
+#include "av1/common/enums.h"
+#include "av1/common/filter.h"
+#include "av1/common/odintrin.h"
+#include "av1/common/quant_common.h"
+
+struct macroblockd;
+
+/* Encoder forward decls */
+struct macroblock;
+struct txfm_param;
+struct aom_variance_vtable;
+struct search_site_config;
+struct mv;
+union int_mv;
+struct yv12_buffer_config;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void aom_clpf_block_c(uint8_t* dst,
+                      const uint16_t* src,
+                      int dstride,
+                      int sstride,
+                      int sizex,
+                      int sizey,
+                      unsigned int strength,
+                      unsigned int bd);
+#define aom_clpf_block aom_clpf_block_c
+
+void aom_clpf_block_hbd_c(uint16_t* dst,
+                          const uint16_t* src,
+                          int dstride,
+                          int sstride,
+                          int sizex,
+                          int sizey,
+                          unsigned int strength,
+                          unsigned int bd);
+#define aom_clpf_block_hbd aom_clpf_block_hbd_c
+
+void aom_clpf_hblock_c(uint8_t* dst,
+                       const uint16_t* src,
+                       int dstride,
+                       int sstride,
+                       int sizex,
+                       int sizey,
+                       unsigned int strength,
+                       unsigned int bd);
+#define aom_clpf_hblock aom_clpf_hblock_c
+
+void aom_clpf_hblock_hbd_c(uint16_t* dst,
+                           const uint16_t* src,
+                           int dstride,
+                           int sstride,
+                           int sizex,
+                           int sizey,
+                           unsigned int strength,
+                           unsigned int bd);
+#define aom_clpf_hblock_hbd aom_clpf_hblock_hbd_c
+
+void av1_convolve_2d_c(const uint8_t* src,
+                       int src_stride,
+                       CONV_BUF_TYPE* dst,
+                       int dst_stride,
+                       int w,
+                       int h,
+                       InterpFilterParams* filter_params_x,
+                       InterpFilterParams* filter_params_y,
+                       const int subpel_x_q4,
+                       const int subpel_y_q4,
+                       ConvolveParams* conv_params);
+#define av1_convolve_2d av1_convolve_2d_c
+
+void av1_convolve_2d_scale_c(const uint8_t* src,
+                             int src_stride,
+                             CONV_BUF_TYPE* dst,
+                             int dst_stride,
+                             int w,
+                             int h,
+                             InterpFilterParams* filter_params_x,
+                             InterpFilterParams* filter_params_y,
+                             const int subpel_x_qn,
+                             const int x_step_qn,
+                             const int subpel_y_q4,
+                             const int y_step_qn,
+                             ConvolveParams* conv_params);
+#define av1_convolve_2d_scale av1_convolve_2d_scale_c
+
+void av1_convolve_horiz_c(const uint8_t* src,
+                          int src_stride,
+                          uint8_t* dst,
+                          int dst_stride,
+                          int w,
+                          int h,
+                          const InterpFilterParams fp,
+                          const int subpel_x_q4,
+                          int x_step_q4,
+                          ConvolveParams* conv_params);
+#define av1_convolve_horiz av1_convolve_horiz_c
+
+void av1_convolve_rounding_c(const int32_t* src,
+                             int src_stride,
+                             uint8_t* dst,
+                             int dst_stride,
+                             int w,
+                             int h,
+                             int bits);
+#define av1_convolve_rounding av1_convolve_rounding_c
+
+void av1_convolve_vert_c(const uint8_t* src,
+                         int src_stride,
+                         uint8_t* dst,
+                         int dst_stride,
+                         int w,
+                         int h,
+                         const InterpFilterParams fp,
+                         const int subpel_x_q4,
+                         int x_step_q4,
+                         ConvolveParams* conv_params);
+#define av1_convolve_vert av1_convolve_vert_c
+
+void av1_highbd_convolve8_c(const uint8_t* src,
+                            ptrdiff_t src_stride,
+                            uint8_t* dst,
+                            ptrdiff_t dst_stride,
+                            const int16_t* filter_x,
+                            int x_step_q4,
+                            const int16_t* filter_y,
+                            int y_step_q4,
+                            int w,
+                            int h,
+                            int bps);
+#define av1_highbd_convolve8 av1_highbd_convolve8_c
+
+void av1_highbd_convolve8_avg_c(const uint8_t* src,
+                                ptrdiff_t src_stride,
+                                uint8_t* dst,
+                                ptrdiff_t dst_stride,
+                                const int16_t* filter_x,
+                                int x_step_q4,
+                                const int16_t* filter_y,
+                                int y_step_q4,
+                                int w,
+                                int h,
+                                int bps);
+#define av1_highbd_convolve8_avg av1_highbd_convolve8_avg_c
+
+void av1_highbd_convolve8_avg_horiz_c(const uint8_t* src,
+                                      ptrdiff_t src_stride,
+                                      uint8_t* dst,
+                                      ptrdiff_t dst_stride,
+                                      const int16_t* filter_x,
+                                      int x_step_q4,
+                                      const int16_t* filter_y,
+                                      int y_step_q4,
+                                      int w,
+                                      int h,
+                                      int bps);
+#define av1_highbd_convolve8_avg_horiz av1_highbd_convolve8_avg_horiz_c
+
+void av1_highbd_convolve8_avg_vert_c(const uint8_t* src,
+                                     ptrdiff_t src_stride,
+                                     uint8_t* dst,
+                                     ptrdiff_t dst_stride,
+                                     const int16_t* filter_x,
+                                     int x_step_q4,
+                                     const int16_t* filter_y,
+                                     int y_step_q4,
+                                     int w,
+                                     int h,
+                                     int bps);
+#define av1_highbd_convolve8_avg_vert av1_highbd_convolve8_avg_vert_c
+
+void av1_highbd_convolve8_horiz_c(const uint8_t* src,
+                                  ptrdiff_t src_stride,
+                                  uint8_t* dst,
+                                  ptrdiff_t dst_stride,
+                                  const int16_t* filter_x,
+                                  int x_step_q4,
+                                  const int16_t* filter_y,
+                                  int y_step_q4,
+                                  int w,
+                                  int h,
+                                  int bps);
+#define av1_highbd_convolve8_horiz av1_highbd_convolve8_horiz_c
+
+void av1_highbd_convolve8_vert_c(const uint8_t* src,
+                                 ptrdiff_t src_stride,
+                                 uint8_t* dst,
+                                 ptrdiff_t dst_stride,
+                                 const int16_t* filter_x,
+                                 int x_step_q4,
+                                 const int16_t* filter_y,
+                                 int y_step_q4,
+                                 int w,
+                                 int h,
+                                 int bps);
+#define av1_highbd_convolve8_vert av1_highbd_convolve8_vert_c
+
+void av1_highbd_convolve_2d_c(const uint16_t* src,
+                              int src_stride,
+                              CONV_BUF_TYPE* dst,
+                              int dst_stride,
+                              int w,
+                              int h,
+                              InterpFilterParams* filter_params_x,
+                              InterpFilterParams* filter_params_y,
+                              const int subpel_x_q4,
+                              const int subpel_y_q4,
+                              ConvolveParams* conv_params,
+                              int bd);
+#define av1_highbd_convolve_2d av1_highbd_convolve_2d_c
+
+void av1_highbd_convolve_2d_scale_c(const uint16_t* src,
+                                    int src_stride,
+                                    CONV_BUF_TYPE* dst,
+                                    int dst_stride,
+                                    int w,
+                                    int h,
+                                    InterpFilterParams* filter_params_x,
+                                    InterpFilterParams* filter_params_y,
+                                    const int subpel_x_q4,
+                                    const int x_step_qn,
+                                    const int subpel_y_q4,
+                                    const int y_step_qn,
+                                    ConvolveParams* conv_params,
+                                    int bd);
+#define av1_highbd_convolve_2d_scale av1_highbd_convolve_2d_scale_c
+
+void av1_highbd_convolve_avg_c(const uint8_t* src,
+                               ptrdiff_t src_stride,
+                               uint8_t* dst,
+                               ptrdiff_t dst_stride,
+                               const int16_t* filter_x,
+                               int x_step_q4,
+                               const int16_t* filter_y,
+                               int y_step_q4,
+                               int w,
+                               int h,
+                               int bps);
+#define av1_highbd_convolve_avg av1_highbd_convolve_avg_c
+
+void av1_highbd_convolve_copy_c(const uint8_t* src,
+                                ptrdiff_t src_stride,
+                                uint8_t* dst,
+                                ptrdiff_t dst_stride,
+                                const int16_t* filter_x,
+                                int x_step_q4,
+                                const int16_t* filter_y,
+                                int y_step_q4,
+                                int w,
+                                int h,
+                                int bps);
+#define av1_highbd_convolve_copy av1_highbd_convolve_copy_c
+
+void av1_highbd_convolve_horiz_c(const uint16_t* src,
+                                 int src_stride,
+                                 uint16_t* dst,
+                                 int dst_stride,
+                                 int w,
+                                 int h,
+                                 const InterpFilterParams fp,
+                                 const int subpel_x_q4,
+                                 int x_step_q4,
+                                 int avg,
+                                 int bd);
+#define av1_highbd_convolve_horiz av1_highbd_convolve_horiz_c
+
+void av1_highbd_convolve_init_c(void);
+#define av1_highbd_convolve_init av1_highbd_convolve_init_c
+
+void av1_highbd_convolve_rounding_c(const int32_t* src,
+                                    int src_stride,
+                                    uint8_t* dst,
+                                    int dst_stride,
+                                    int w,
+                                    int h,
+                                    int bits,
+                                    int bd);
+#define av1_highbd_convolve_rounding av1_highbd_convolve_rounding_c
+
+void av1_highbd_convolve_vert_c(const uint16_t* src,
+                                int src_stride,
+                                uint16_t* dst,
+                                int dst_stride,
+                                int w,
+                                int h,
+                                const InterpFilterParams fp,
+                                const int subpel_x_q4,
+                                int x_step_q4,
+                                int avg,
+                                int bd);
+#define av1_highbd_convolve_vert av1_highbd_convolve_vert_c
+
+void av1_highbd_iht16x16_256_add_c(const tran_low_t* input,
+                                   uint8_t* output,
+                                   int pitch,
+                                   const struct txfm_param* param);
+#define av1_highbd_iht16x16_256_add av1_highbd_iht16x16_256_add_c
+
+void av1_highbd_iht16x32_512_add_c(const tran_low_t* input,
+                                   uint8_t* dest,
+                                   int dest_stride,
+                                   const struct txfm_param* param);
+#define av1_highbd_iht16x32_512_add av1_highbd_iht16x32_512_add_c
+
+void av1_highbd_iht16x4_64_add_c(const tran_low_t* input,
+                                 uint8_t* dest,
+                                 int dest_stride,
+                                 const struct txfm_param* param);
+#define av1_highbd_iht16x4_64_add av1_highbd_iht16x4_64_add_c
+
+void av1_highbd_iht16x8_128_add_c(const tran_low_t* input,
+                                  uint8_t* dest,
+                                  int dest_stride,
+                                  const struct txfm_param* param);
+#define av1_highbd_iht16x8_128_add av1_highbd_iht16x8_128_add_c
+
+void av1_highbd_iht32x16_512_add_c(const tran_low_t* input,
+                                   uint8_t* dest,
+                                   int dest_stride,
+                                   const struct txfm_param* param);
+#define av1_highbd_iht32x16_512_add av1_highbd_iht32x16_512_add_c
+
+void av1_highbd_iht32x8_256_add_c(const tran_low_t* input,
+                                  uint8_t* dest,
+                                  int dest_stride,
+                                  const struct txfm_param* param);
+#define av1_highbd_iht32x8_256_add av1_highbd_iht32x8_256_add_c
+
+void av1_highbd_iht4x16_64_add_c(const tran_low_t* input,
+                                 uint8_t* dest,
+                                 int dest_stride,
+                                 const struct txfm_param* param);
+#define av1_highbd_iht4x16_64_add av1_highbd_iht4x16_64_add_c
+
+void av1_highbd_iht4x4_16_add_c(const tran_low_t* input,
+                                uint8_t* dest,
+                                int dest_stride,
+                                const struct txfm_param* param);
+#define av1_highbd_iht4x4_16_add av1_highbd_iht4x4_16_add_c
+
+void av1_highbd_iht4x8_32_add_c(const tran_low_t* input,
+                                uint8_t* dest,
+                                int dest_stride,
+                                const struct txfm_param* param);
+#define av1_highbd_iht4x8_32_add av1_highbd_iht4x8_32_add_c
+
+void av1_highbd_iht8x16_128_add_c(const tran_low_t* input,
+                                  uint8_t* dest,
+                                  int dest_stride,
+                                  const struct txfm_param* param);
+#define av1_highbd_iht8x16_128_add av1_highbd_iht8x16_128_add_c
+
+void av1_highbd_iht8x32_256_add_c(const tran_low_t* input,
+                                  uint8_t* dest,
+                                  int dest_stride,
+                                  const struct txfm_param* param);
+#define av1_highbd_iht8x32_256_add av1_highbd_iht8x32_256_add_c
+
+void av1_highbd_iht8x4_32_add_c(const tran_low_t* input,
+                                uint8_t* dest,
+                                int dest_stride,
+                                const struct txfm_param* param);
+#define av1_highbd_iht8x4_32_add av1_highbd_iht8x4_32_add_c
+
+void av1_highbd_iht8x8_64_add_c(const tran_low_t* input,
+                                uint8_t* dest,
+                                int dest_stride,
+                                const struct txfm_param* param);
+#define av1_highbd_iht8x8_64_add av1_highbd_iht8x8_64_add_c
+
+void av1_highbd_warp_affine_c(const int32_t* mat,
+                              const uint16_t* ref,
+                              int width,
+                              int height,
+                              int stride,
+                              uint16_t* pred,
+                              int p_col,
+                              int p_row,
+                              int p_width,
+                              int p_height,
+                              int p_stride,
+                              int subsampling_x,
+                              int subsampling_y,
+                              int bd,
+                              ConvolveParams* conv_params,
+                              int16_t alpha,
+                              int16_t beta,
+                              int16_t gamma,
+                              int16_t delta);
+#define av1_highbd_warp_affine av1_highbd_warp_affine_c
+
+void av1_iht16x16_256_add_c(const tran_low_t* input,
+                            uint8_t* output,
+                            int pitch,
+                            const struct txfm_param* param);
+#define av1_iht16x16_256_add av1_iht16x16_256_add_c
+
+void av1_iht16x32_512_add_c(const tran_low_t* input,
+                            uint8_t* dest,
+                            int dest_stride,
+                            const struct txfm_param* param);
+#define av1_iht16x32_512_add av1_iht16x32_512_add_c
+
+void av1_iht16x4_64_add_c(const tran_low_t* input,
+                          uint8_t* dest,
+                          int dest_stride,
+                          const struct txfm_param* param);
+#define av1_iht16x4_64_add av1_iht16x4_64_add_c
+
+void av1_iht16x8_128_add_c(const tran_low_t* input,
+                           uint8_t* dest,
+                           int dest_stride,
+                           const struct txfm_param* param);
+#define av1_iht16x8_128_add av1_iht16x8_128_add_c
+
+void av1_iht32x16_512_add_c(const tran_low_t* input,
+                            uint8_t* dest,
+                            int dest_stride,
+                            const struct txfm_param* param);
+#define av1_iht32x16_512_add av1_iht32x16_512_add_c
+
+void av1_iht32x32_1024_add_c(const tran_low_t* input,
+                             uint8_t* output,
+                             int pitch,
+                             const struct txfm_param* param);
+#define av1_iht32x32_1024_add av1_iht32x32_1024_add_c
+
+void av1_iht32x8_256_add_c(const tran_low_t* input,
+                           uint8_t* dest,
+                           int dest_stride,
+                           const struct txfm_param* param);
+#define av1_iht32x8_256_add av1_iht32x8_256_add_c
+
+void av1_iht4x16_64_add_c(const tran_low_t* input,
+                          uint8_t* dest,
+                          int dest_stride,
+                          const struct txfm_param* param);
+#define av1_iht4x16_64_add av1_iht4x16_64_add_c
+
+void av1_iht4x4_16_add_c(const tran_low_t* input,
+                         uint8_t* dest,
+                         int dest_stride,
+                         const struct txfm_param* param);
+#define av1_iht4x4_16_add av1_iht4x4_16_add_c
+
+void av1_iht4x8_32_add_c(const tran_low_t* input,
+                         uint8_t* dest,
+                         int dest_stride,
+                         const struct txfm_param* param);
+#define av1_iht4x8_32_add av1_iht4x8_32_add_c
+
+void av1_iht8x16_128_add_c(const tran_low_t* input,
+                           uint8_t* dest,
+                           int dest_stride,
+                           const struct txfm_param* param);
+#define av1_iht8x16_128_add av1_iht8x16_128_add_c
+
+void av1_iht8x32_256_add_c(const tran_low_t* input,
+                           uint8_t* dest,
+                           int dest_stride,
+                           const struct txfm_param* param);
+#define av1_iht8x32_256_add av1_iht8x32_256_add_c
+
+void av1_iht8x4_32_add_c(const tran_low_t* input,
+                         uint8_t* dest,
+                         int dest_stride,
+                         const struct txfm_param* param);
+#define av1_iht8x4_32_add av1_iht8x4_32_add_c
+
+void av1_iht8x8_64_add_c(const tran_low_t* input,
+                         uint8_t* dest,
+                         int dest_stride,
+                         const struct txfm_param* param);
+#define av1_iht8x8_64_add av1_iht8x8_64_add_c
+
+void av1_inv_txfm2d_add_16x16_c(const int32_t* input,
+                                uint16_t* output,
+                                int stride,
+                                int tx_type,
+                                int bd);
+#define av1_inv_txfm2d_add_16x16 av1_inv_txfm2d_add_16x16_c
+
+void av1_inv_txfm2d_add_16x32_c(const int32_t* input,
+                                uint16_t* output,
+                                int stride,
+                                int tx_type,
+                                int bd);
+#define av1_inv_txfm2d_add_16x32 av1_inv_txfm2d_add_16x32_c
+
+void av1_inv_txfm2d_add_16x8_c(const int32_t* input,
+                               uint16_t* output,
+                               int stride,
+                               int tx_type,
+                               int bd);
+#define av1_inv_txfm2d_add_16x8 av1_inv_txfm2d_add_16x8_c
+
+void av1_inv_txfm2d_add_32x16_c(const int32_t* input,
+                                uint16_t* output,
+                                int stride,
+                                int tx_type,
+                                int bd);
+#define av1_inv_txfm2d_add_32x16 av1_inv_txfm2d_add_32x16_c
+
+void av1_inv_txfm2d_add_32x32_c(const int32_t* input,
+                                uint16_t* output,
+                                int stride,
+                                int tx_type,
+                                int bd);
+#define av1_inv_txfm2d_add_32x32 av1_inv_txfm2d_add_32x32_c
+
+void av1_inv_txfm2d_add_4x4_c(const int32_t* input,
+                              uint16_t* output,
+                              int stride,
+                              int tx_type,
+                              int bd);
+#define av1_inv_txfm2d_add_4x4 av1_inv_txfm2d_add_4x4_c
+
+void av1_inv_txfm2d_add_4x8_c(const int32_t* input,
+                              uint16_t* output,
+                              int stride,
+                              int tx_type,
+                              int bd);
+#define av1_inv_txfm2d_add_4x8 av1_inv_txfm2d_add_4x8_c
+
+void av1_inv_txfm2d_add_64x64_c(const int32_t* input,
+                                uint16_t* output,
+                                int stride,
+                                int tx_type,
+                                int bd);
+#define av1_inv_txfm2d_add_64x64 av1_inv_txfm2d_add_64x64_c
+
+void av1_inv_txfm2d_add_8x16_c(const int32_t* input,
+                               uint16_t* output,
+                               int stride,
+                               int tx_type,
+                               int bd);
+#define av1_inv_txfm2d_add_8x16 av1_inv_txfm2d_add_8x16_c
+
+void av1_inv_txfm2d_add_8x4_c(const int32_t* input,
+                              uint16_t* output,
+                              int stride,
+                              int tx_type,
+                              int bd);
+#define av1_inv_txfm2d_add_8x4 av1_inv_txfm2d_add_8x4_c
+
+void av1_inv_txfm2d_add_8x8_c(const int32_t* input,
+                              uint16_t* output,
+                              int stride,
+                              int tx_type,
+                              int bd);
+#define av1_inv_txfm2d_add_8x8 av1_inv_txfm2d_add_8x8_c
+
+void av1_lowbd_convolve_init_c(void);
+#define av1_lowbd_convolve_init av1_lowbd_convolve_init_c
+
+void av1_warp_affine_c(const int32_t* mat,
+                       const uint8_t* ref,
+                       int width,
+                       int height,
+                       int stride,
+                       uint8_t* pred,
+                       int p_col,
+                       int p_row,
+                       int p_width,
+                       int p_height,
+                       int p_stride,
+                       int subsampling_x,
+                       int subsampling_y,
+                       ConvolveParams* conv_params,
+                       int16_t alpha,
+                       int16_t beta,
+                       int16_t gamma,
+                       int16_t delta);
+#define av1_warp_affine av1_warp_affine_c
+
+void cdef_direction_4x4_c(uint16_t* y,
+                          int ystride,
+                          const uint16_t* in,
+                          int threshold,
+                          int dir,
+                          int damping);
+#define cdef_direction_4x4 cdef_direction_4x4_c
+
+void cdef_direction_8x8_c(uint16_t* y,
+                          int ystride,
+                          const uint16_t* in,
+                          int threshold,
+                          int dir,
+                          int damping);
+#define cdef_direction_8x8 cdef_direction_8x8_c
+
+int cdef_find_dir_c(const uint16_t* img,
+                    int stride,
+                    int32_t* var,
+                    int coeff_shift);
+#define cdef_find_dir cdef_find_dir_c
+
+void copy_4x4_16bit_to_16bit_c(uint16_t* dst,
+                               int dstride,
+                               const uint16_t* src,
+                               int sstride);
+#define copy_4x4_16bit_to_16bit copy_4x4_16bit_to_16bit_c
+
+void copy_4x4_16bit_to_8bit_c(uint8_t* dst,
+                              int dstride,
+                              const uint16_t* src,
+                              int sstride);
+#define copy_4x4_16bit_to_8bit copy_4x4_16bit_to_8bit_c
+
+void copy_8x8_16bit_to_16bit_c(uint16_t* dst,
+                               int dstride,
+                               const uint16_t* src,
+                               int sstride);
+#define copy_8x8_16bit_to_16bit copy_8x8_16bit_to_16bit_c
+
+void copy_8x8_16bit_to_8bit_c(uint8_t* dst,
+                              int dstride,
+                              const uint16_t* src,
+                              int sstride);
+#define copy_8x8_16bit_to_8bit copy_8x8_16bit_to_8bit_c
+
+void copy_rect8_16bit_to_16bit_c(uint16_t* dst,
+                                 int dstride,
+                                 const uint16_t* src,
+                                 int sstride,
+                                 int v,
+                                 int h);
+#define copy_rect8_16bit_to_16bit copy_rect8_16bit_to_16bit_c
+
+void copy_rect8_8bit_to_16bit_c(uint16_t* dst,
+                                int dstride,
+                                const uint8_t* src,
+                                int sstride,
+                                int v,
+                                int h);
+#define copy_rect8_8bit_to_16bit copy_rect8_8bit_to_16bit_c
+
+void av1_rtcd(void);
+
+#include "aom_config.h"
+
+#ifdef RTCD_C
+static void setup_rtcd_internal(void) {}
+#endif
+
+#ifdef __cplusplus
+}  // extern "C"
+#endif
+
+#endif
diff --git a/tools/metrics/ukm/ukm.xml b/tools/metrics/ukm/ukm.xml
index 7c71528..903fb0a 100644
--- a/tools/metrics/ukm/ukm.xml
+++ b/tools/metrics/ukm/ukm.xml
@@ -1543,6 +1543,11 @@
       Set to 1 when a user is shown a lite page in page load.
     </summary>
   </metric>
+  <metric name="noscript">
+    <summary>
+      Set to 1 when a user is shown a NoScript preview on a page load.
+    </summary>
+  </metric>
   <metric name="opt_out">
     <summary>
       Set to 1 when a user clicks &quot;Show Original&quot; on a preview page
diff --git a/ui/android/java/src/org/chromium/ui/base/TouchDevice.java b/ui/android/java/src/org/chromium/ui/base/TouchDevice.java
index d6bcdce..dc7bc2a 100644
--- a/ui/android/java/src/org/chromium/ui/base/TouchDevice.java
+++ b/ui/android/java/src/org/chromium/ui/base/TouchDevice.java
@@ -82,9 +82,6 @@
                     || hasSource(sources, InputDevice.SOURCE_TOUCHPAD)
                     || hasSource(sources, InputDevice.SOURCE_TRACKBALL)) {
                 result[1] |= HoverType.HOVER;
-            } else if (hasSource(sources, InputDevice.SOURCE_STYLUS)
-                    || hasSource(sources, InputDevice.SOURCE_TOUCHSCREEN)) {
-                result[1] |= HoverType.NONE;
             }
 
             // Remaining InputDevice sources: SOURCE_DPAD, SOURCE_GAMEPAD, SOURCE_JOYSTICK,
diff --git a/ui/aura/window_occlusion_tracker.cc b/ui/aura/window_occlusion_tracker.cc
index abce896..dca604b 100644
--- a/ui/aura/window_occlusion_tracker.cc
+++ b/ui/aura/window_occlusion_tracker.cc
@@ -240,7 +240,16 @@
   if (!root_window)
     return;
   auto root_window_state_it = root_windows_.find(root_window);
-  DCHECK(root_window_state_it != root_windows_.end());
+
+  // This may be called if a WindowObserver or a LayoutManager changes |window|
+  // after Window::AddChild() has added it to a new root but before
+  // OnWindowAddedToRootWindow() is called on |this|. In that case, do nothing
+  // here and rely on OnWindowAddedToRootWindow() to mark the new root as dirty.
+  if (root_window_state_it == root_windows_.end()) {
+    DCHECK(WindowIsTracked(window));
+    return;
+  }
+
   if (root_window_state_it->second.dirty)
     return;
   if (predicate()) {
diff --git a/ui/aura/window_occlusion_tracker_unittest.cc b/ui/aura/window_occlusion_tracker_unittest.cc
index e7e800146..3d71981 100644
--- a/ui/aura/window_occlusion_tracker_unittest.cc
+++ b/ui/aura/window_occlusion_tracker_unittest.cc
@@ -1118,4 +1118,46 @@
   window_a->layer()->SetAnimator(nullptr);
 }
 
+namespace {
+
+class ObserverChangingWindowBounds : public WindowObserver {
+ public:
+  ObserverChangingWindowBounds() = default;
+
+  // WindowObserver:
+  void OnWindowParentChanged(Window* window, Window* parent) override {
+    window->SetBounds(gfx::Rect(1, 2, 3, 4));
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(ObserverChangingWindowBounds);
+};
+
+}  // namespace
+
+// Verify that no crash occurs if a tracked window is modified by an observer
+// after it has been added to a new root but before WindowOcclusionTracker has
+// been notified.
+TEST_F(WindowOcclusionTrackerTest, ChangeTrackedWindowBeforeObserveAddToRoot) {
+  // Create a window. Expect it to be non-occluded.
+  MockWindowDelegate* delegate = new MockWindowDelegate();
+  delegate->set_expectation(WindowOcclusionChangedExpectation::NOT_OCCLUDED);
+  Window* window = CreateTrackedWindow(delegate, gfx::Rect(0, 0, 10, 10));
+  EXPECT_FALSE(delegate->is_expecting_call());
+
+  // Remove the window from its root.
+  root_window()->RemoveChild(window);
+
+  // Add an observer that changes the bounds of |window| when it gets a new
+  // parent.
+  ObserverChangingWindowBounds observer;
+  window->AddObserver(&observer);
+
+  // Re-add the window to its root. Expect no crash when |observer| changes the
+  // bounds.
+  root_window()->AddChild(window);
+
+  window->RemoveObserver(&observer);
+}
+
 }  // namespace aura
diff --git a/ui/base/touch/touch_device_linux.cc b/ui/base/touch/touch_device_linux.cc
index d9ef84f2..b9039974 100644
--- a/ui/base/touch/touch_device_linux.cc
+++ b/ui/base/touch/touch_device_linux.cc
@@ -15,7 +15,7 @@
   return !InputDeviceManager::GetInstance()->GetTouchscreenDevices().empty();
 }
 
-bool isMouseOrTouchpadPresent() {
+bool IsMouseOrTouchpadPresent() {
   InputDeviceManager* input_manager = InputDeviceManager::GetInstance();
   for (const ui::InputDevice& device : input_manager->GetTouchpadDevices()) {
     if (device.enabled)
@@ -33,7 +33,7 @@
 
 int GetAvailablePointerTypes() {
   int available_pointer_types = 0;
-  if (isMouseOrTouchpadPresent())
+  if (IsMouseOrTouchpadPresent())
     available_pointer_types |= POINTER_TYPE_FINE;
 
   if (IsTouchDevicePresent())
@@ -47,10 +47,10 @@
 }
 
 int GetAvailableHoverTypes() {
-  int available_hover_types = HOVER_TYPE_NONE;
-  if (isMouseOrTouchpadPresent())
-    available_hover_types |= HOVER_TYPE_HOVER;
-  return available_hover_types;
+  if (IsMouseOrTouchpadPresent())
+    return HOVER_TYPE_HOVER;
+
+  return HOVER_TYPE_NONE;
 }
 
 TouchScreensAvailability GetTouchScreensAvailability() {
diff --git a/ui/base/touch/touch_device_win.cc b/ui/base/touch/touch_device_win.cc
index c862df98..53b28e61 100644
--- a/ui/base/touch/touch_device_win.cc
+++ b/ui/base/touch/touch_device_win.cc
@@ -57,15 +57,10 @@
   if (base::win::IsTabletDevice(nullptr, ui::GetHiddenWindow()))
     return HOVER_TYPE_NONE;
 
-  int available_hover_types;
-  if (GetSystemMetrics(SM_MOUSEPRESENT) != 0) {
-    available_hover_types = HOVER_TYPE_HOVER;
-    if (IsTouchDevicePresent())
-      available_hover_types |= HOVER_TYPE_NONE;
-  } else
-    available_hover_types = HOVER_TYPE_NONE;
+  if (GetSystemMetrics(SM_MOUSEPRESENT) != 0)
+    return HOVER_TYPE_HOVER;
 
-  return available_hover_types;
+  return HOVER_TYPE_NONE;
 }
 
 TouchScreensAvailability GetTouchScreensAvailability() {
diff --git a/ui/webui/resources/cr_components/cr_components_resources.grdp b/ui/webui/resources/cr_components/cr_components_resources.grdp
index e1d7cc7..3b4e57c 100644
--- a/ui/webui/resources/cr_components/cr_components_resources.grdp
+++ b/ui/webui/resources/cr_components/cr_components_resources.grdp
@@ -78,7 +78,7 @@
     <structure name="IDR_WEBUI_CERTIFICATE_SHARED_CSS_HTML"
                file="cr_components/certificate_manager/certificate_shared_css.html"
                type="chrome_html"
-               preprocess="true" />
+               compress="gzip" />
     <structure name="IDR_WEBUI_CERTIFICATE_SUBENTRY_HTML"
                file="cr_components/certificate_manager/certificate_subentry.html"
                type="chrome_html"