Make SIFT faster

This uses various halide-optimized functions to do the actual image
processing. It still finds around the same number of features, but much
faster.

Change-Id: I9d7f7093b0ec41acf7ed16b2c91cdadada2f9a22
diff --git a/y2020/vision/sift/fast_gaussian.bzl b/y2020/vision/sift/fast_gaussian.bzl
new file mode 100644
index 0000000..a1c3173
--- /dev/null
+++ b/y2020/vision/sift/fast_gaussian.bzl
@@ -0,0 +1,55 @@
+def fast_gaussian(sigmas, sizes):
+  files = []
+  for _, sigma_name, _ in sigmas:
+    for cols, rows in sizes:
+      files.append("fast_gaussian_%dx%d_%s" % (cols, rows, sigma_name))
+  for _, sigma_name, _ in sigmas:
+    for cols, rows in sizes:
+      files.append("fast_gaussian_subtract_%dx%d_%s" % (cols, rows, sigma_name))
+  for cols, rows in sizes:
+    files.append('fast_subtract_%dx%d' % (cols, rows))
+
+  params = struct(
+    sigmas = sigmas,
+    sizes = sizes,
+  )
+
+  headers = [f + '.h' for f in files] + [
+    'fast_gaussian_all.h',
+  ]
+  objects = [f + '.o' for f in files] + [
+    'fast_gaussian_runtime.o',
+  ]
+  htmls = [f + '.html' for f in files]
+
+  native.genrule(
+    name = "generate_fast_gaussian",
+    tools = [
+        ":fast_gaussian_runner",
+    ],
+    cmd = ' '.join([
+      '$(location fast_gaussian_runner)',
+      "'" + params.to_json() + "'",
+      # TODO(Brian): This should be RULEDIR once we have support for that.
+      '$(@D)',
+      '$(TARGET_CPU)',
+    ]),
+    outs = headers + objects + htmls,
+    restricted_to = [
+      "//tools:k8",
+      "//tools:armhf-debian",
+    ],
+  )
+
+  native.cc_library(
+    name = 'fast_gaussian_all',
+    hdrs = ['fast_gaussian_all.h'],
+    srcs = headers + objects,
+    deps = [
+      '//third_party:halide_runtime',
+    ],
+    restricted_to = [
+      "//tools:k8",
+      "//tools:armhf-debian",
+    ],
+  )