blob: 09054232a504b5c98b9a6b66fea4e1cf08d9c839 [file] [log] [blame]
Brian Silverman3fec6482020-01-19 17:56:20 -08001def fast_gaussian(sigmas, sizes):
Austin Schuha4f69d62020-02-28 13:58:14 -08002 files = []
3 for _, sigma_name, _ in sigmas:
4 for cols, rows in sizes:
5 files.append("fast_gaussian_%dx%d_%s" % (cols, rows, sigma_name))
6 for _, sigma_name, _ in sigmas:
7 for cols, rows in sizes:
8 files.append("fast_gaussian_subtract_%dx%d_%s" % (cols, rows, sigma_name))
Brian Silverman3fec6482020-01-19 17:56:20 -08009 for cols, rows in sizes:
Austin Schuha4f69d62020-02-28 13:58:14 -080010 files.append("fast_subtract_%dx%d" % (cols, rows))
Brian Silverman3fec6482020-01-19 17:56:20 -080011
Austin Schuha4f69d62020-02-28 13:58:14 -080012 params = struct(
13 sigmas = sigmas,
14 sizes = sizes,
15 )
Brian Silverman3fec6482020-01-19 17:56:20 -080016
Austin Schuha4f69d62020-02-28 13:58:14 -080017 headers = [f + ".h" for f in files] + [
18 "fast_gaussian_all.h",
19 ]
20 objects = [f + ".o" for f in files] + [
21 "fast_gaussian_runtime.o",
22 ]
23 htmls = [f + ".html" for f in files]
Brian Silverman3fec6482020-01-19 17:56:20 -080024
Austin Schuha4f69d62020-02-28 13:58:14 -080025 native.genrule(
26 name = "generate_fast_gaussian",
27 tools = [
28 ":fast_gaussian_runner",
29 ],
30 cmd = " ".join([
31 "$(location fast_gaussian_runner)",
32 "'" + params.to_json() + "'",
33 # TODO(Brian): This should be RULEDIR once we have support for that.
34 "$(@D)",
35 "$(TARGET_CPU)",
36 ]),
37 outs = headers + objects + htmls,
38 restricted_to = [
39 "//tools:k8",
40 "//tools:armhf-debian",
41 ],
42 )
Brian Silverman3fec6482020-01-19 17:56:20 -080043
Austin Schuha4f69d62020-02-28 13:58:14 -080044 native.cc_library(
45 name = "fast_gaussian_all",
46 hdrs = ["fast_gaussian_all.h"],
47 srcs = headers + objects,
48 deps = [
49 "//third_party:halide_runtime",
50 ],
51 restricted_to = [
52 "//tools:k8",
53 "//tools:armhf-debian",
54 ],
55 )