From 386b7d3366f1359a265da207a9cafa3edf553b64 Mon Sep 17 00:00:00 2001 From: Joshua Bakita Date: Mon, 7 Oct 2019 19:13:39 -0400 Subject: Reorganize and commit all the modified TACLeBench code and run scripts --- all_pairs/source/susan/ChangeLog.txt | 11 + all_pairs/source/susan/LICENSE | 14 + all_pairs/source/susan/input.c | 7292 +++++++++++++++++++++++++++++++++ all_pairs/source/susan/math_private.h | 178 + all_pairs/source/susan/susan.c | 2014 +++++++++ all_pairs/source/susan/wccfile.c | 79 + all_pairs/source/susan/wccfile.h | 24 + all_pairs/source/susan/wcclibm.c | 444 ++ all_pairs/source/susan/wcclibm.h | 53 + all_pairs/source/susan/wccmalloc.c | 51 + all_pairs/source/susan/wccmalloc.h | 10 + 11 files changed, 10170 insertions(+) create mode 100644 all_pairs/source/susan/ChangeLog.txt create mode 100644 all_pairs/source/susan/LICENSE create mode 100644 all_pairs/source/susan/input.c create mode 100644 all_pairs/source/susan/math_private.h create mode 100644 all_pairs/source/susan/susan.c create mode 100644 all_pairs/source/susan/wccfile.c create mode 100644 all_pairs/source/susan/wccfile.h create mode 100644 all_pairs/source/susan/wcclibm.c create mode 100644 all_pairs/source/susan/wcclibm.h create mode 100644 all_pairs/source/susan/wccmalloc.c create mode 100644 all_pairs/source/susan/wccmalloc.h (limited to 'all_pairs/source/susan') diff --git a/all_pairs/source/susan/ChangeLog.txt b/all_pairs/source/susan/ChangeLog.txt new file mode 100644 index 0000000..bb603df --- /dev/null +++ b/all_pairs/source/susan/ChangeLog.txt @@ -0,0 +1,11 @@ +2017-07-04 + - Removed self-assignment to avoid clangs self-assign warning. + - Introduced susan_initm susan_main and susan_return. + - Fix possible division by zero to please tacle-lint. + - Removed unused variables. + - Added prefix 'susan_'. + - Removed exit_on_error function. + - Removed PowerPC specific typedef. + +2017-08-18: + - Give explicit name to former anonymous struct to silence g++ warnings. diff --git a/all_pairs/source/susan/LICENSE b/all_pairs/source/susan/LICENSE new file mode 100644 index 0000000..18d5124 --- /dev/null +++ b/all_pairs/source/susan/LICENSE @@ -0,0 +1,14 @@ +This code is issued for research purposes only and remains the +property of the UK Secretary of State for Defence. This code must +not be passed on without this header information being kept +intact. This code must not be sold. + +A UK patent has been granted: "Method for digitally processing +images to determine the position of edges and/or corners therein for +guidance of unmanned vehicle", UK Patent 2272285. Proprietor: +Secretary of State for Defence, UK. 15 January 1997 + + +Source Code obtained from: + +http://www.fmrib.ox.ac.uk/~steve/susan/index.html diff --git a/all_pairs/source/susan/input.c b/all_pairs/source/susan/input.c new file mode 100644 index 0000000..4e6ba40 --- /dev/null +++ b/all_pairs/source/susan/input.c @@ -0,0 +1,7292 @@ +char susan_input[7292] = { 80, +53, +10, +35, +32, +67, +82, +69, +65, +84, +79, +82, +58, +32, +88, +86, +32, +86, +101, +114, +115, +105, +111, +110, +32, +51, +46, +49, +48, +97, +32, +32, +82, +101, +118, +58, +32, +49, +50, +47, +50, +57, +47, +57, +52, +32, +40, +80, +78, +71, +32, +112, +97, +116, +99, +104, +32, +49, +46, +50, +41, +10, +55, +54, +32, +57, +53, +10, +50, +53, +53, +10, +35, +36, +36, +36, +36, +38, +38, +36, +37, +37, +37, +38, +38, +36, +34, +38, +40, +41, +42, +40, +38, +36, +36, +35, +36, +35, +32, +35, +38, +42, +42, +38, +36, +36, +36, +37, +36, +35, +33, +33, +33, +32, +31, +33, +36, +39, +40, +36, +36, +34, +34, +36, +38, +39, +37, +36, +36, +35, +36, +39, +39, +37, +37, +39, +37, +38, +39, +40, +38, +37, +37, +33, +33, +32, +33, +34, +35, +35, +36, +36, +36, +37, +38, +37, +38, +38, +39, +41, +41, +40, +40, +43, +42, +41, +40, +39, +38, +35, +33, +35, +35, +37, +39, +38, +37, +36, +38, +36, +36, +34, +34, +38, +39, +39, +37, +36, +36, +34, +33, +34, +33, +35, +33, +36, +35, +35, +36, +36, +37, +33, +32, +36, +38, +38, +38, +39, +39, +38, +39, +37, +35, +36, +34, +35, +36, +37, +39, +38, +37, +34, +31, +34, +35, +35, +35, +35, +36, +38, +39, +39, +37, +38, +38, +40, +39, +40, +41, +43, +44, +42, +40, +39, +38, +42, +42, +39, +39, +36, +33, +33, +34, +36, +36, +35, +33, +33, +35, +37, +36, +34, +34, +31, +30, +32, +36, +42, +43, +43, +40, +36, +36, +36, +35, +34, +35, +33, +33, +30, +32, +34, +35, +35, +35, +36, +35, +37, +34, +34, +35, +36, +37, +37, +35, +36, +37, +39, +39, +38, +35, +35, +35, +35, +35, +36, +38, +37, +38, +38, +36, +35, +35, +36, +35, +35, +35, +35, +34, +34, +36, +36, +38, +40, +38, +37, +36, +34, +34, +35, +35, +36, +37, +37, +38, +38, +39, +39, +36, +35, +36, +35, +37, +36, +38, +39, +37, +38, +34, +33, +32, +33, +32, +28, +34, +40, +45, +44, +40, +38, +34, +30, +30, +33, +40, +45, +43, +41, +37, +37, +37, +36, +33, +31, +32, +31, +35, +35, +35, +35, +35, +38, +39, +39, +40, +39, +37, +37, +37, +35, +35, +37, +37, +36, +37, +37, +37, +38, +37, +38, +37, +37, +35, +35, +34, +35, +35, +35, +36, +39, +45, +43, +38, +39, +38, +36, +36, +36, +35, +37, +39, +38, +37, +37, +37, +39, +38, +37, +37, +35, +34, +34, +37, +39, +36, +37, +38, +39, +40, +41, +39, +36, +38, +39, +39, +39, +36, +33, +32, +30, +30, +31, +35, +35, +35, +35, +35, +39, +40, +38, +37, +40, +39, +38, +39, +39, +39, +38, +39, +39, +40, +40, +39, +41, +39, +41, +39, +38, +39, +38, +38, +36, +35, +36, +35, +37, +38, +38, +38, +40, +38, +39, +39, +36, +36, +33, +34, +36, +35, +37, +38, +39, +39, +38, +36, +32, +32, +35, +38, +38, +39, +38, +35, +35, +34, +37, +39, +38, +36, +35, +35, +33, +31, +30, +32, +36, +37, +38, +35, +35, +35, +35, +35, +39, +41, +42, +38, +33, +31, +33, +37, +36, +37, +38, +37, +37, +38, +39, +38, +38, +38, +38, +37, +38, +38, +39, +41, +41, +37, +39, +40, +42, +44, +43, +39, +42, +48, +45, +41, +39, +38, +38, +38, +38, +36, +37, +38, +39, +39, +39, +43, +41, +38, +37, +37, +38, +36, +34, +34, +34, +38, +41, +41, +38, +35, +35, +34, +35, +32, +30, +31, +33, +34, +35, +35, +35, +35, +35, +35, +39, +36, +35, +38, +41, +38, +32, +34, +38, +34, +38, +40, +39, +39, +36, +36, +39, +38, +39, +37, +38, +38, +36, +36, +35, +37, +38, +39, +38, +36, +38, +37, +35, +31, +35, +37, +40, +39, +35, +35, +36, +34, +36, +36, +38, +37, +38, +37, +37, +36, +37, +38, +37, +36, +35, +34, +34, +34, +37, +36, +37, +36, +34, +36, +36, +34, +31, +30, +33, +32, +33, +35, +35, +35, +35, +34, +27, +33, +39, +42, +41, +42, +44, +45, +42, +39, +41, +41, +42, +43, +42, +41, +40, +38, +37, +35, +37, +36, +36, +36, +37, +36, +36, +37, +37, +39, +43, +43, +43, +42, +39, +39, +39, +39, +40, +39, +38, +35, +34, +36, +37, +36, +37, +38, +38, +37, +36, +35, +35, +33, +35, +38, +38, +39, +41, +39, +38, +37, +38, +38, +36, +37, +36, +37, +37, +36, +36, +35, +35, +35, +35, +36, +42, +40, +41, +43, +42, +39, +37, +37, +37, +37, +39, +39, +38, +37, +35, +37, +36, +35, +36, +36, +39, +39, +36, +36, +34, +37, +40, +40, +40, +39, +41, +40, +39, +39, +39, +40, +38, +36, +34, +35, +37, +34, +36, +35, +35, +34, +33, +36, +36, +38, +39, +38, +37, +34, +34, +33, +34, +35, +36, +36, +35, +36, +35, +38, +39, +39, +40, +38, +37, +36, +36, +35, +35, +35, +35, +36, +36, +42, +45, +44, +43, +40, +38, +37, +36, +37, +37, +38, +38, +38, +38, +36, +35, +35, +34, +34, +36, +38, +36, +35, +38, +37, +37, +38, +38, +37, +38, +36, +33, +35, +37, +37, +38, +38, +41, +41, +41, +38, +35, +33, +30, +29, +32, +37, +39, +39, +38, +39, +38, +35, +34, +35, +35, +35, +35, +34, +35, +36, +36, +37, +38, +38, +38, +36, +35, +33, +34, +35, +35, +35, +35, +36, +36, +32, +33, +36, +38, +40, +42, +42, +39, +40, +41, +43, +42, +36, +33, +32, +33, +32, +35, +37, +41, +41, +39, +40, +37, +36, +38, +39, +41, +40, +40, +41, +39, +37, +37, +36, +37, +37, +36, +35, +37, +37, +39, +41, +41, +43, +41, +40, +40, +37, +37, +38, +38, +38, +38, +38, +36, +38, +37, +36, +39, +41, +41, +42, +41, +39, +38, +38, +36, +37, +37, +35, +35, +35, +36, +36, +33, +35, +37, +34, +35, +35, +35, +39, +38, +39, +41, +43, +43, +43, +42, +39, +38, +39, +37, +37, +38, +37, +36, +38, +38, +40, +38, +39, +39, +36, +35, +34, +33, +34, +36, +37, +38, +37, +37, +37, +36, +34, +34, +33, +34, +35, +38, +41, +38, +36, +37, +37, +37, +37, +39, +41, +40, +41, +42, +41, +40, +41, +41, +39, +40, +40, +39, +37, +37, +36, +38, +35, +35, +35, +36, +37, +45, +42, +40, +44, +45, +42, +43, +42, +42, +45, +47, +49, +51, +50, +51, +50, +49, +45, +45, +45, +43, +42, +42, +43, +41, +39, +40, +40, +40, +39, +38, +40, +40, +39, +39, +39, +38, +35, +33, +37, +41, +42, +39, +37, +37, +37, +38, +38, +36, +37, +35, +33, +32, +33, +34, +35, +35, +38, +39, +37, +38, +36, +35, +37, +38, +39, +42, +41, +38, +36, +34, +35, +35, +35, +35, +36, +39, +38, +36, +37, +37, +37, +36, +40, +42, +43, +47, +49, +48, +47, +44, +43, +47, +52, +55, +52, +47, +44, +42, +42, +42, +40, +40, +39, +38, +37, +37, +39, +38, +38, +38, +36, +33, +31, +34, +35, +38, +39, +38, +37, +38, +38, +37, +38, +37, +42, +46, +45, +42, +39, +39, +38, +34, +36, +39, +39, +37, +35, +36, +34, +37, +37, +36, +36, +39, +41, +42, +35, +35, +35, +35, +36, +40, +40, +38, +39, +39, +36, +36, +38, +39, +42, +46, +49, +50, +52, +52, +51, +51, +52, +54, +51, +50, +51, +52, +51, +47, +47, +46, +47, +45, +43, +43, +43, +43, +43, +42, +41, +41, +40, +40, +42, +46, +44, +41, +37, +36, +37, +39, +39, +38, +38, +39, +38, +38, +39, +37, +35, +35, +38, +38, +38, +36, +35, +35, +37, +35, +36, +38, +36, +38, +38, +39, +35, +35, +35, +36, +36, +39, +39, +40, +40, +39, +37, +38, +41, +39, +43, +46, +47, +49, +49, +49, +48, +48, +51, +52, +52, +53, +53, +52, +51, +52, +50, +48, +49, +48, +46, +47, +47, +44, +42, +43, +44, +43, +45, +48, +46, +45, +44, +42, +43, +46, +45, +44, +42, +41, +38, +39, +38, +37, +36, +35, +37, +35, +37, +36, +33, +31, +32, +38, +43, +42, +41, +39, +37, +38, +37, +37, +35, +35, +36, +36, +36, +38, +38, +36, +37, +39, +38, +39, +38, +39, +42, +47, +49, +46, +46, +47, +47, +46, +47, +49, +48, +48, +49, +51, +50, +49, +50, +51, +48, +46, +46, +47, +48, +47, +45, +43, +42, +44, +45, +47, +49, +51, +51, +51, +49, +47, +48, +47, +49, +46, +44, +40, +39, +40, +40, +39, +38, +40, +38, +39, +40, +39, +37, +36, +35, +33, +35, +34, +32, +33, +34, +38, +35, +36, +36, +36, +36, +35, +36, +38, +36, +37, +37, +37, +38, +38, +39, +43, +46, +51, +52, +50, +50, +48, +50, +49, +49, +50, +48, +50, +50, +49, +49, +51, +54, +54, +51, +51, +49, +47, +48, +52, +53, +51, +49, +46, +46, +43, +46, +45, +47, +50, +49, +47, +47, +46, +45, +48, +48, +45, +43, +44, +43, +43, +42, +41, +39, +39, +39, +37, +37, +34, +34, +32, +33, +35, +36, +39, +35, +36, +36, +36, +36, +40, +39, +36, +36, +35, +34, +33, +32, +37, +43, +51, +56, +54, +55, +56, +55, +52, +50, +49, +46, +46, +45, +47, +49, +51, +54, +54, +51, +49, +50, +50, +48, +47, +45, +46, +47, +50, +50, +48, +43, +42, +42, +43, +45, +47, +47, +48, +50, +49, +47, +47, +48, +49, +47, +48, +48, +47, +47, +45, +44, +42, +39, +38, +38, +38, +42, +41, +41, +39, +36, +35, +35, +35, +36, +36, +36, +34, +37, +37, +35, +36, +36, +35, +36, +37, +38, +41, +50, +67, +82, +84, +80, +80, +76, +75, +74, +71, +64, +61, +58, +54, +53, +54, +56, +56, +53, +51, +51, +49, +47, +49, +49, +48, +48, +47, +47, +48, +48, +47, +45, +46, +47, +46, +46, +45, +41, +42, +44, +44, +45, +45, +48, +47, +44, +42, +37, +35, +34, +32, +33, +37, +40, +37, +37, +36, +36, +37, +35, +35, +36, +36, +36, +37, +35, +37, +37, +37, +35, +35, +35, +37, +40, +41, +46, +58, +85, +119, +-119, +-123, +123, +115, +109, +110, +109, +107, +102, +95, +93, +88, +86, +86, +86, +86, +83, +77, +68, +64, +59, +58, +61, +61, +61, +58, +56, +51, +49, +51, +51, +50, +50, +45, +37, +41, +47, +50, +50, +53, +52, +49, +48, +45, +43, +42, +39, +38, +36, +38, +39, +39, +39, +38, +37, +36, +35, +35, +35, +36, +36, +34, +36, +36, +38, +39, +38, +37, +39, +41, +43, +47, +56, +79, +121, +-106, +-110, +-108, +-99, +-102, +-100, +-99, +-101, +-103, +-102, +-106, +-108, +-110, +-111, +-111, +-115, +-117, +-120, +-123, +-123, +-125, +-128, +127, +124, +118, +114, +119, +113, +104, +99, +100, +100, +97, +89, +83, +79, +76, +73, +69, +60, +52, +48, +47, +45, +46, +40, +37, +38, +38, +42, +45, +43, +42, +42, +39, +38, +39, +35, +35, +36, +36, +36, +37, +37, +40, +42, +42, +40, +39, +38, +40, +43, +49, +60, +83, +126, +-105, +-98, +-93, +-97, +-94, +-93, +-90, +-88, +-91, +-94, +-91, +-90, +-93, +-94, +-94, +-96, +-94, +-94, +-96, +-95, +-93, +-96, +-100, +-104, +-104, +-105, +-108, +-110, +-115, +-119, +-120, +-122, +-125, +127, +122, +118, +115, +118, +113, +97, +78, +59, +45, +48, +46, +40, +38, +38, +37, +38, +38, +35, +37, +37, +34, +32, +32, +35, +36, +36, +36, +36, +38, +39, +38, +37, +38, +35, +34, +36, +35, +37, +41, +51, +77, +120, +-100, +-91, +-96, +-95, +-93, +-92, +-89, +-90, +-92, +-92, +-93, +-93, +-91, +-90, +-91, +-94, +-94, +-94, +-93, +-92, +-93, +-95, +-95, +-93, +-94, +-94, +-91, +-92, +-94, +-93, +-91, +-92, +-91, +-92, +-96, +-97, +-99, +-105, +-112, +126, +95, +63, +43, +47, +42, +38, +38, +36, +36, +36, +38, +37, +37, +37, +36, +37, +38, +35, +36, +36, +36, +36, +39, +39, +39, +41, +38, +33, +35, +37, +39, +45, +51, +58, +80, +121, +-104, +-94, +-93, +-92, +-94, +-94, +-91, +-89, +-89, +-88, +-86, +-86, +-88, +-87, +-88, +-90, +-90, +-91, +-91, +-89, +-87, +-90, +-92, +-92, +-90, +-91, +-91, +-89, +-89, +-90, +-92, +-93, +-91, +-90, +-91, +-90, +-91, +-91, +-100, +-128, +88, +54, +44, +47, +48, +46, +43, +41, +36, +37, +40, +38, +40, +38, +38, +37, +39, +35, +36, +36, +36, +36, +38, +41, +39, +37, +35, +32, +34, +36, +38, +42, +47, +57, +82, +118, +-105, +-88, +-86, +-84, +-88, +-91, +-91, +-91, +-92, +-91, +-89, +-90, +-89, +-87, +-88, +-88, +-89, +-89, +-91, +-91, +-91, +-92, +-93, +-92, +-93, +-97, +-93, +-93, +-93, +-92, +-92, +-94, +-94, +-92, +-94, +-94, +-91, +-91, +-98, +-122, +96, +63, +53, +49, +44, +42, +42, +41, +38, +36, +37, +36, +37, +38, +39, +38, +40, +35, +36, +36, +36, +36, +34, +36, +35, +37, +39, +40, +43, +41, +41, +44, +48, +56, +83, +-127, +-99, +-89, +-88, +-87, +-88, +-89, +-87, +-89, +-90, +-90, +-89, +-91, +-91, +-89, +-87, +-88, +-87, +-89, +-88, +-89, +-88, +-90, +-89, +-87, +-88, +-92, +-91, +-88, +-89, +-88, +-87, +-89, +-91, +-93, +-95, +-97, +-94, +-93, +-99, +-125, +91, +59, +45, +45, +47, +43, +42, +39, +36, +36, +36, +40, +38, +39, +39, +37, +36, +36, +36, +36, +36, +36, +34, +37, +38, +39, +40, +43, +43, +43, +43, +40, +43, +56, +87, +-127, +-100, +-94, +-95, +-91, +-88, +-90, +-89, +-90, +-92, +-88, +-88, +-90, +-88, +-90, +-90, +-89, +-89, +-91, +-91, +-92, +-92, +-91, +-90, +-89, +-89, +-92, +-90, +-90, +-92, +-91, +-89, +-90, +-91, +-91, +-95, +-94, +-92, +-93, +-99, +-124, +92, +61, +48, +47, +49, +45, +44, +41, +38, +37, +37, +38, +34, +35, +35, +35, +35, +36, +36, +36, +36, +36, +40, +39, +36, +34, +35, +35, +37, +37, +40, +49, +56, +62, +89, +-124, +-99, +-93, +-88, +-88, +-92, +-90, +-87, +-88, +-89, +-87, +-88, +-89, +-88, +-87, +-88, +-89, +-89, +-87, +-88, +-88, +-87, +-89, +-92, +-91, +-92, +-92, +-91, +-91, +-90, +-89, +-89, +-89, +-90, +-92, +-93, +-91, +-87, +-86, +-96, +-127, +90, +60, +45, +44, +43, +36, +36, +37, +39, +38, +40, +40, +37, +36, +36, +33, +35, +36, +36, +36, +36, +36, +34, +34, +34, +33, +34, +34, +35, +37, +40, +42, +41, +50, +80, +-127, +-96, +-92, +-89, +-85, +-88, +-91, +-88, +-88, +-89, +-87, +-90, +-90, +-89, +-89, +-90, +-91, +-90, +-89, +-87, +-86, +-87, +-89, +-90, +-91, +-93, +-93, +-93, +-91, +-91, +-90, +-90, +-91, +-92, +-91, +-92, +-89, +-87, +-88, +-96, +-123, +96, +65, +48, +47, +45, +38, +37, +37, +37, +37, +39, +39, +37, +38, +36, +35, +35, +36, +36, +36, +36, +36, +40, +41, +40, +41, +42, +42, +41, +39, +39, +45, +53, +66, +100, +-111, +-86, +-86, +-87, +-80, +-86, +-92, +-88, +-86, +-87, +-84, +-83, +-86, +-86, +-85, +-85, +-86, +-84, +-84, +-88, +-90, +-87, +-88, +-88, +-88, +-88, +-90, +-89, +-89, +-89, +-89, +-89, +-88, +-87, +-88, +-90, +-87, +-88, +-90, +-98, +-127, +93, +69, +50, +50, +51, +43, +44, +43, +41, +37, +37, +40, +38, +38, +37, +36, +38, +36, +36, +36, +36, +36, +36, +38, +39, +40, +39, +40, +39, +42, +46, +49, +52, +62, +90, +-123, +-101, +-100, +-98, +-94, +-90, +-88, +-87, +-89, +-90, +-89, +-88, +-88, +-87, +-86, +-87, +-86, +-86, +-87, +-85, +-85, +-88, +-89, +-88, +-89, +-88, +-89, +-90, +-89, +-90, +-90, +-91, +-90, +-89, +-91, +-91, +-91, +-90, +-92, +-99, +-126, +93, +61, +45, +49, +48, +43, +41, +38, +37, +36, +38, +38, +37, +36, +35, +35, +39, +36, +36, +36, +36, +37, +41, +42, +40, +41, +41, +38, +40, +42, +42, +45, +50, +61, +91, +-121, +-94, +-93, +-96, +-94, +-94, +-93, +-91, +-91, +-93, +-90, +-88, +-92, +-90, +-87, +-87, +-89, +-88, +-87, +-89, +-89, +-90, +-93, +-96, +-94, +-91, +-89, +-88, +-88, +-90, +-90, +-89, +-91, +-92, +-93, +-91, +-91, +-92, +-91, +-101, +122, +84, +60, +48, +52, +46, +34, +36, +36, +37, +34, +34, +37, +34, +32, +33, +34, +37, +36, +36, +36, +37, +37, +36, +39, +39, +41, +40, +41, +40, +39, +42, +44, +49, +62, +92, +-124, +-96, +-84, +-81, +-86, +-87, +-89, +-90, +-91, +-92, +-90, +-88, +-89, +-91, +-90, +-89, +-89, +-89, +-90, +-89, +-86, +-88, +-89, +-89, +-90, +-88, +-90, +-91, +-91, +-92, +-92, +-92, +-91, +-91, +-93, +-95, +-94, +-93, +-93, +-101, +125, +86, +61, +47, +47, +49, +45, +44, +44, +43, +44, +45, +44, +42, +41, +38, +35, +38, +37, +37, +37, +37, +37, +39, +40, +40, +42, +44, +42, +43, +47, +45, +44, +50, +66, +99, +-111, +-93, +-97, +-96, +-92, +-89, +-89, +-89, +-87, +-88, +-86, +-87, +-90, +-88, +-88, +-88, +-87, +-87, +-88, +-91, +-93, +-91, +-92, +-89, +-86, +-84, +-83, +-83, +-87, +-90, +-91, +-90, +-91, +-92, +-93, +-94, +-97, +-96, +-97, +-107, +119, +79, +53, +39, +39, +38, +37, +40, +38, +38, +37, +38, +40, +41, +39, +38, +36, +36, +37, +37, +37, +37, +37, +40, +39, +40, +40, +40, +40, +38, +39, +43, +44, +48, +59, +95, +-121, +-103, +-96, +-95, +-97, +-94, +-92, +-90, +-90, +-90, +-88, +-85, +-88, +-89, +-88, +-89, +-91, +-92, +-92, +-91, +-90, +-88, +-88, +-88, +-90, +-91, +-92, +-91, +-89, +-93, +-93, +-92, +-92, +-91, +-93, +-94, +-94, +-94, +-93, +-105, +118, +79, +52, +38, +36, +40, +41, +41, +42, +39, +38, +40, +40, +39, +39, +39, +37, +38, +37, +37, +37, +37, +37, +41, +42, +40, +41, +43, +43, +45, +43, +42, +43, +47, +62, +95, +-120, +-93, +-92, +-96, +-92, +-94, +-92, +-91, +-88, +-88, +-89, +-90, +-91, +-88, +-88, +-89, +-88, +-91, +-93, +-92, +-91, +-90, +-89, +-90, +-89, +-91, +-90, +-90, +-94, +-95, +-95, +-94, +-91, +-87, +-83, +-87, +-88, +-89, +-94, +-106, +117, +79, +60, +51, +45, +40, +37, +38, +38, +36, +34, +33, +34, +34, +33, +35, +37, +36, +37, +37, +37, +37, +37, +36, +40, +38, +39, +40, +41, +38, +40, +43, +48, +52, +62, +96, +-120, +-103, +-99, +-94, +-95, +-93, +-92, +-90, +-89, +-90, +-91, +-90, +-92, +-95, +-95, +-94, +-94, +-92, +-92, +-93, +-93, +-92, +-91, +-90, +-92, +-94, +-93, +-92, +-89, +-91, +-89, +-87, +-88, +-91, +-97, +-98, +-95, +-94, +-94, +-104, +123, +86, +61, +48, +46, +47, +40, +38, +37, +34, +36, +35, +39, +41, +40, +39, +37, +37, +37, +37, +37, +37, +37, +39, +39, +40, +39, +40, +42, +41, +40, +43, +42, +43, +52, +85, +125, +-106, +-92, +-98, +-96, +-84, +-82, +-87, +-86, +-85, +-86, +-86, +-90, +-88, +-88, +-87, +-87, +-92, +-93, +-93, +-93, +-90, +-91, +-92, +-89, +-89, +-89, +-89, +-91, +-91, +-93, +-93, +-94, +-93, +-92, +-94, +-94, +-91, +-92, +-100, +123, +79, +57, +47, +45, +47, +40, +37, +36, +35, +38, +37, +39, +40, +38, +39, +36, +35, +37, +37, +37, +37, +37, +41, +38, +33, +31, +37, +44, +44, +44, +46, +48, +52, +64, +96, +-117, +-98, +-103, +-99, +-97, +-96, +-97, +-97, +-94, +-89, +-85, +-90, +-91, +-89, +-89, +-89, +-88, +-87, +-86, +-90, +-92, +-91, +-93, +-91, +-92, +-92, +-91, +-93, +-92, +-92, +-92, +-91, +-94, +-94, +-94, +-95, +-93, +-98, +-102, +-110, +117, +83, +55, +40, +46, +48, +44, +42, +39, +40, +37, +39, +40, +38, +38, +38, +39, +42, +37, +37, +37, +37, +38, +39, +40, +41, +41, +41, +41, +40, +42, +46, +47, +52, +65, +102, +-114, +-102, +-97, +-100, +-95, +-83, +-88, +-91, +-89, +-91, +-91, +-89, +-89, +-88, +-90, +-89, +-88, +-88, +-88, +-89, +-92, +-90, +-90, +-90, +-90, +-92, +-94, +-95, +-94, +-93, +-92, +-90, +-90, +-92, +-92, +-94, +-92, +-92, +-96, +-108, +116, +76, +57, +50, +47, +42, +38, +41, +42, +41, +37, +36, +37, +36, +36, +37, +35, +35, +37, +37, +37, +37, +38, +39, +40, +41, +39, +41, +40, +36, +34, +37, +39, +42, +61, +100, +-113, +-90, +-97, +-96, +-90, +-87, +-88, +-90, +-91, +-93, +-89, +-91, +-91, +-90, +-90, +-91, +-91, +-89, +-87, +-90, +-91, +-89, +-90, +-89, +-90, +-90, +-92, +-92, +-92, +-91, +-91, +-89, +-90, +-92, +-90, +-92, +-93, +-93, +-96, +-107, +119, +81, +48, +37, +40, +44, +45, +41, +40, +38, +36, +37, +38, +37, +37, +37, +36, +35, +37, +37, +37, +37, +39, +47, +50, +45, +40, +41, +40, +41, +42, +44, +48, +53, +64, +98, +-116, +-95, +-96, +-97, +-87, +-83, +-87, +-87, +-88, +-87, +-86, +-86, +-87, +-91, +-95, +-94, +-92, +-88, +-89, +-90, +-90, +-88, +-87, +-88, +-90, +-94, +-92, +-93, +-91, +-89, +-89, +-87, +-86, +-87, +-90, +-92, +-92, +-91, +-92, +-100, +125, +79, +52, +51, +54, +50, +47, +47, +47, +46, +45, +46, +44, +40, +36, +34, +34, +34, +37, +37, +37, +37, +38, +41, +42, +42, +39, +39, +37, +35, +39, +46, +52, +53, +68, +101, +-119, +-101, +-101, +-101, +-93, +-90, +-89, +-88, +-88, +-88, +-85, +-89, +-90, +-89, +-91, +-93, +-92, +-90, +-90, +-90, +-91, +-91, +-90, +-91, +-93, +-91, +-92, +-92, +-89, +-90, +-91, +-92, +-95, +-95, +-94, +-95, +-95, +-96, +-97, +-110, +116, +81, +54, +48, +52, +51, +49, +45, +47, +46, +43, +44, +43, +38, +35, +35, +34, +36, +37, +37, +37, +37, +39, +43, +43, +41, +40, +42, +41, +41, +40, +40, +44, +50, +68, +106, +-112, +-93, +-93, +-95, +-92, +-94, +-93, +-90, +-89, +-90, +-88, +-90, +-89, +-88, +-89, +-89, +-89, +-86, +-88, +-91, +-92, +-92, +-91, +-92, +-91, +-91, +-92, +-91, +-92, +-90, +-90, +-91, +-88, +-87, +-90, +-92, +-91, +-91, +-92, +-104, +121, +80, +54, +43, +45, +46, +41, +41, +40, +38, +38, +38, +37, +37, +37, +37, +39, +40, +37, +37, +37, +37, +37, +39, +39, +40, +38, +40, +41, +40, +41, +43, +46, +52, +69, +105, +-112, +-92, +-95, +-94, +-90, +-94, +-94, +-92, +-91, +-90, +-91, +-90, +-90, +-90, +-90, +-89, +-88, +-89, +-90, +-90, +-93, +-94, +-93, +-92, +-91, +-91, +-92, +-94, +-91, +-91, +-89, +-89, +-93, +-95, +-96, +-97, +-96, +-96, +-96, +-106, +121, +86, +54, +47, +53, +50, +48, +43, +40, +39, +37, +40, +40, +38, +38, +36, +37, +37, +37, +37, +37, +37, +37, +39, +38, +38, +38, +38, +37, +37, +39, +41, +42, +45, +62, +104, +-112, +-93, +-87, +-91, +-92, +-92, +-91, +-89, +-91, +-89, +-90, +-88, +-86, +-88, +-90, +-91, +-91, +-90, +-91, +-91, +-91, +-90, +-89, +-90, +-89, +-90, +-93, +-91, +-92, +-92, +-91, +-92, +-91, +-91, +-94, +-94, +-92, +-93, +-92, +-103, +124, +92, +65, +49, +47, +45, +39, +40, +40, +40, +37, +37, +37, +37, +41, +41, +38, +38, +37, +37, +37, +37, +38, +46, +42, +42, +40, +41, +41, +37, +39, +43, +49, +59, +78, +112, +-105, +-88, +-94, +-93, +-96, +-95, +-92, +-90, +-88, +-90, +-91, +-90, +-88, +-89, +-90, +-89, +-90, +-91, +-90, +-91, +-93, +-93, +-92, +-92, +-91, +-91, +-90, +-92, +-92, +-92, +-93, +-92, +-92, +-92, +-94, +-94, +-94, +-94, +-93, +-107, +116, +77, +48, +43, +47, +43, +41, +40, +39, +38, +38, +42, +40, +38, +37, +34, +34, +34, +36, +37, +37, +37, +37, +41, +41, +38, +38, +39, +40, +39, +39, +40, +40, +45, +63, +102, +-117, +-98, +-92, +-88, +-87, +-91, +-90, +-89, +-90, +-91, +-93, +-90, +-83, +-85, +-87, +-88, +-90, +-91, +-93, +-92, +-93, +-91, +-89, +-89, +-89, +-91, +-94, +-92, +-91, +-90, +-92, +-92, +-92, +-93, +-91, +-89, +-90, +-89, +-87, +-99, +126, +86, +54, +43, +45, +46, +42, +40, +38, +36, +34, +34, +36, +34, +35, +34, +35, +36, +36, +37, +37, +37, +38, +43, +40, +38, +38, +40, +41, +40, +41, +41, +42, +50, +74, +113, +-113, +-98, +-95, +-88, +-88, +-90, +-91, +-90, +-90, +-92, +-91, +-88, +-86, +-87, +-86, +-86, +-89, +-91, +-92, +-92, +-91, +-88, +-90, +-93, +-95, +-97, +-97, +-95, +-94, +-93, +-92, +-92, +-92, +-93, +-94, +-94, +-96, +-95, +-96, +-111, +111, +73, +42, +39, +50, +45, +41, +40, +38, +38, +39, +41, +38, +35, +35, +33, +30, +28, +36, +37, +37, +37, +37, +37, +40, +38, +40, +41, +41, +43, +42, +40, +42, +49, +74, +119, +-100, +-88, +-94, +-93, +-90, +-94, +-94, +-91, +-89, +-89, +-90, +-89, +-88, +-93, +-94, +-91, +-89, +-87, +-90, +-96, +-98, +-96, +-94, +-94, +-92, +-92, +-92, +-89, +-88, +-89, +-91, +-90, +-89, +-88, +-86, +-87, +-90, +-93, +-95, +-110, +113, +79, +59, +52, +43, +38, +38, +38, +41, +41, +39, +41, +42, +41, +40, +40, +40, +39, +37, +37, +37, +37, +37, +39, +38, +40, +40, +42, +40, +41, +43, +47, +50, +53, +74, +112, +-114, +-99, +-95, +-92, +-94, +-95, +-95, +-92, +-90, +-91, +-88, +-85, +-89, +-88, +-87, +-88, +-89, +-89, +-91, +-91, +-90, +-88, +-91, +-94, +-93, +-93, +-93, +-94, +-93, +-91, +-90, +-90, +-92, +-93, +-94, +-92, +-94, +-94, +-95, +-110, +113, +78, +52, +46, +49, +45, +43, +42, +43, +41, +39, +41, +40, +38, +38, +35, +37, +39, +37, +37, +37, +37, +37, +35, +38, +38, +41, +42, +39, +42, +43, +44, +46, +55, +80, +119, +-108, +-99, +-95, +-91, +-90, +-95, +-95, +-92, +-90, +-94, +-94, +-89, +-88, +-92, +-91, +-91, +-93, +-93, +-93, +-93, +-91, +-89, +-90, +-93, +-91, +-89, +-88, +-89, +-88, +-89, +-92, +-93, +-93, +-93, +-92, +-92, +-95, +-95, +-97, +-113, +108, +67, +48, +46, +41, +41, +42, +39, +39, +37, +36, +38, +38, +36, +37, +39, +38, +39, +37, +37, +37, +37, +36, +32, +34, +36, +38, +38, +38, +38, +41, +42, +44, +50, +67, +115, +-98, +-89, +-94, +-93, +-87, +-86, +-91, +-90, +-92, +-93, +-92, +-89, +-91, +-92, +-90, +-92, +-92, +-91, +-90, +-90, +-89, +-87, +-90, +-93, +-92, +-92, +-95, +-94, +-94, +-93, +-91, +-92, +-94, +-95, +-96, +-93, +-93, +-92, +-95, +-112, +107, +73, +56, +45, +45, +44, +41, +41, +39, +38, +37, +39, +39, +37, +38, +37, +39, +41, +37, +37, +37, +37, +37, +40, +39, +41, +42, +42, +39, +39, +43, +47, +49, +56, +76, +112, +-112, +-102, +-90, +-78, +-88, +-93, +-92, +-92, +-90, +-89, +-91, +-88, +-86, +-90, +-88, +-87, +-89, +-91, +-90, +-90, +-89, +-90, +-90, +-88, +-90, +-89, +-89, +-89, +-87, +-90, +-91, +-90, +-90, +-88, +-90, +-92, +-93, +-93, +-97, +-112, +108, +71, +52, +48, +51, +48, +45, +40, +40, +41, +42, +42, +41, +39, +41, +42, +39, +37, +37, +37, +37, +37, +37, +38, +39, +40, +40, +40, +40, +42, +45, +46, +45, +51, +72, +121, +-98, +-99, +-100, +-95, +-93, +-96, +-95, +-93, +-90, +-90, +-87, +-89, +-89, +-90, +-89, +-90, +-90, +-89, +-92, +-94, +-90, +-91, +-91, +-91, +-90, +-89, +-90, +-88, +-90, +-92, +-91, +-92, +-93, +-94, +-96, +-94, +-94, +-95, +-97, +-113, +106, +71, +52, +48, +46, +45, +45, +41, +37, +33, +33, +35, +35, +37, +38, +37, +36, +35, +37, +37, +37, +37, +37, +37, +37, +38, +39, +39, +39, +40, +42, +40, +42, +50, +73, +114, +-107, +-96, +-100, +-97, +-100, +-103, +-101, +-97, +-92, +-89, +-89, +-87, +-85, +-88, +-89, +-87, +-87, +-88, +-88, +-89, +-91, +-92, +-89, +-86, +-86, +-84, +-86, +-86, +-90, +-94, +-94, +-93, +-93, +-94, +-94, +-93, +-92, +-94, +-99, +-115, +106, +72, +60, +59, +57, +55, +48, +42, +39, +37, +37, +39, +37, +37, +38, +37, +35, +33, +37, +37, +37, +37, +38, +45, +43, +42, +39, +36, +35, +34, +38, +40, +42, +50, +76, +115, +-110, +-97, +-89, +-88, +-92, +-95, +-94, +-91, +-90, +-88, +-86, +-87, +-88, +-87, +-86, +-88, +-88, +-88, +-91, +-90, +-89, +-90, +-89, +-89, +-91, +-90, +-91, +-90, +-91, +-93, +-93, +-93, +-95, +-97, +-96, +-92, +-94, +-97, +-100, +-118, +106, +72, +54, +50, +48, +47, +46, +44, +40, +36, +38, +40, +42, +41, +40, +38, +36, +38, +37, +37, +37, +37, +37, +39, +41, +41, +41, +40, +41, +45, +47, +47, +46, +53, +77, +119, +-102, +-90, +-94, +-89, +-88, +-94, +-90, +-87, +-86, +-85, +-87, +-87, +-85, +-86, +-86, +-87, +-88, +-90, +-90, +-91, +-91, +-91, +-93, +-91, +-91, +-92, +-93, +-93, +-92, +-94, +-93, +-90, +-91, +-92, +-92, +-91, +-94, +-96, +-95, +-105, +114, +74, +57, +51, +50, +53, +47, +42, +39, +37, +41, +46, +46, +43, +40, +35, +31, +29, +37, +37, +37, +37, +38, +39, +37, +38, +39, +40, +41, +40, +43, +46, +48, +57, +89, +-126, +-102, +-97, +-96, +-93, +-96, +-92, +-89, +-89, +-91, +-94, +-90, +-91, +-90, +-88, +-88, +-90, +-90, +-90, +-92, +-93, +-93, +-92, +-90, +-89, +-90, +-89, +-91, +-93, +-91, +-92, +-93, +-92, +-94, +-95, +-92, +-92, +-95, +-99, +-100, +-116, +103, +70, +54, +52, +54, +49, +46, +43, +40, +36, +35, +39, +41, +37, +38, +38, +38, +37, +37, +37, +37, +38, +38, +42, +43, +41, +41, +41, +45, +45, +44, +44, +46, +56, +86, +119, +-113, +-96, +-91, +-78, +-83, +-90, +-90, +-90, +-89, +-91, +-92, +-92, +-90, +-88, +-89, +-91, +-91, +-90, +-89, +-89, +-88, +-88, +-90, +-90, +-92, +-92, +-92, +-90, +-90, +-94, +-93, +-91, +-91, +-92, +-94, +-91, +-90, +-95, +-100, +-121, +91, +58, +49, +49, +47, +45, +44, +44, +43, +41, +40, +40, +37, +35, +35, +36, +35, +34, +37, +37, +38, +38, +38, +42, +38, +37, +38, +37, +37, +40, +45, +45, +44, +54, +84, +123, +-106, +-96, +-95, +-96, +-99, +-97, +-96, +-92, +-91, +-92, +-91, +-92, +-95, +-94, +-93, +-92, +-91, +-89, +-91, +-92, +-91, +-91, +-92, +-94, +-92, +-88, +-89, +-91, +-91, +-93, +-94, +-92, +-93, +-92, +-93, +-92, +-94, +-95, +-97, +-118, +95, +55, +33, +34, +37, +37, +34, +33, +33, +31, +34, +36, +36, +34, +35, +36, +37, +38, +37, +37, +38, +38, +38, +40, +40, +42, +43, +43, +41, +41, +40, +43, +43, +50, +77, +116, +-110, +-84, +-81, +-87, +-91, +-94, +-91, +-88, +-88, +-89, +-88, +-88, +-88, +-85, +-88, +-89, +-88, +-88, +-89, +-92, +-91, +-93, +-92, +-92, +-94, +-94, +-93, +-93, +-94, +-96, +-95, +-91, +-89, +-88, +-91, +-92, +-94, +-98, +-100, +-122, +91, +57, +43, +46, +41, +33, +36, +36, +38, +39, +39, +38, +33, +33, +34, +34, +34, +35, +37, +38, +38, +38, +39, +44, +43, +44, +45, +44, +40, +40, +42, +40, +46, +60, +93, +-127, +-103, +-88, +-87, +-94, +-93, +-96, +-97, +-94, +-89, +-90, +-89, +-88, +-90, +-90, +-91, +-92, +-90, +-90, +-91, +-93, +-94, +-94, +-94, +-94, +-93, +-91, +-94, +-96, +-95, +-98, +-97, +-94, +-94, +-95, +-99, +-98, +-95, +-95, +-101, +-121, +95, +58, +42, +39, +44, +44, +39, +37, +41, +42, +41, +41, +37, +33, +33, +32, +33, +33, +37, +38, +38, +38, +38, +39, +41, +44, +44, +47, +46, +44, +41, +39, +40, +52, +85, +127, +-102, +-88, +-82, +-87, +-92, +-94, +-91, +-90, +-91, +-92, +-91, +-89, +-91, +-92, +-91, +-89, +-87, +-86, +-89, +-91, +-92, +-93, +-93, +-92, +-95, +-98, +-95, +-90, +-87, +-90, +-92, +-93, +-94, +-98, +-99, +-97, +-97, +-96, +-98, +-114, +106, +65, +40, +42, +41, +39, +41, +41, +43, +46, +45, +43, +40, +38, +39, +40, +40, +39, +37, +38, +38, +38, +38, +34, +37, +39, +42, +42, +41, +42, +41, +42, +44, +58, +88, +124, +-109, +-98, +-95, +-96, +-97, +-95, +-95, +-95, +-96, +-94, +-91, +-90, +-92, +-91, +-90, +-90, +-89, +-87, +-89, +-92, +-94, +-95, +-96, +-95, +-94, +-94, +-97, +-98, +-97, +-97, +-96, +-95, +-96, +-95, +-98, +-99, +-98, +-97, +-100, +-121, +90, +52, +37, +36, +39, +41, +39, +39, +40, +38, +35, +33, +34, +35, +34, +36, +36, +35, +37, +38, +38, +38, +38, +40, +39, +40, +39, +40, +44, +46, +49, +53, +53, +53, +73, +108, +-114, +-96, +-96, +-99, +-100, +-99, +-96, +-94, +-95, +-93, +-89, +-84, +-88, +-91, +-91, +-93, +-97, +-97, +-98, +-97, +-93, +-92, +-92, +-92, +-95, +-95, +-94, +-92, +-91, +-94, +-96, +-96, +-94, +-94, +-94, +-92, +-93, +-94, +-96, +-115, +103, +64, +36, +38, +45, +42, +44, +41, +41, +41, +37, +38, +42, +45, +46, +43, +39, +33, +37, +38, +38, +38, +38, +42, +42, +38, +36, +35, +34, +36, +40, +39, +39, +49, +82, +-123, +-95, +-91, +-87, +-89, +-93, +-94, +-95, +-94, +-95, +-94, +-91, +-92, +-93, +-92, +-92, +-94, +-95, +-95, +-96, +-94, +-94, +-94, +-93, +-94, +-92, +-90, +-92, +-90, +-91, +-93, +-92, +-92, +-91, +-91, +-93, +-93, +-93, +-93, +-98, +-122, +90, +54, +40, +40, +41, +40, +38, +36, +36, +36, +39, +42, +43, +41, +38, +38, +36, +36, +37, +38, +38, +38, +38, +41, +40, +37, +36, +38, +42, +42, +41, +44, +41, +48, +73, +116, +-103, +-88, +-87, +-92, +-96, +-95, +-93, +-91, +-87, +-85, +-88, +-85, +-89, +-93, +-91, +-88, +-87, +-85, +-87, +-89, +-91, +-93, +-92, +-92, +-92, +-91, +-94, +-90, +-91, +-93, +-93, +-94, +-92, +-92, +-95, +-93, +-92, +-93, +-96, +-116, +104, +66, +40, +39, +37, +39, +42, +43, +43, +40, +38, +37, +36, +36, +34, +34, +35, +35, +37, +38, +38, +38, +38, +41, +41, +38, +37, +36, +35, +37, +42, +44, +46, +58, +91, +-120, +-98, +-99, +-94, +-89, +-93, +-92, +-92, +-93, +-93, +-93, +-91, +-89, +-88, +-85, +-86, +-88, +-89, +-87, +-89, +-88, +-90, +-94, +-93, +-94, +-94, +-91, +-90, +-86, +-90, +-94, +-94, +-96, +-95, +-95, +-94, +-93, +-92, +-91, +-97, +-123, +91, +58, +48, +52, +48, +44, +43, +43, +41, +36, +38, +42, +43, +39, +37, +34, +31, +32, +37, +38, +38, +38, +38, +41, +40, +37, +41, +42, +41, +43, +41, +39, +45, +60, +92, +-123, +-102, +-102, +-99, +-99, +-97, +-92, +-93, +-93, +-94, +-94, +-96, +-93, +-89, +-92, +-91, +-90, +-89, +-90, +-88, +-90, +-90, +-91, +-92, +-92, +-92, +-92, +-94, +-90, +-90, +-90, +-91, +-91, +-91, +-93, +-94, +-91, +-92, +-95, +-103, +-127, +92, +59, +49, +56, +53, +55, +51, +50, +48, +43, +39, +36, +35, +35, +34, +33, +34, +37, +37, +38, +38, +38, +38, +38, +39, +38, +40, +41, +40, +42, +45, +45, +47, +64, +100, +-118, +-104, +-102, +-93, +-95, +-92, +-96, +-97, +-96, +-96, +-94, +-92, +-89, +-90, +-93, +-93, +-96, +-97, +-94, +-96, +-96, +-97, +-98, +-97, +-96, +-94, +-94, +-95, +-92, +-95, +-94, +-94, +-95, +-94, +-95, +-96, +-95, +-94, +-94, +-97, +-118, +102, +70, +53, +53, +55, +52, +54, +52, +47, +41, +38, +39, +40, +36, +37, +37, +35, +36, +37, +38, +38, +38, +38, +40, +39, +40, +41, +39, +33, +33, +36, +40, +51, +64, +84, +125, +-102, +-87, +-81, +-92, +-98, +-101, +-98, +-97, +-95, +-95, +-95, +-94, +-94, +-98, +-97, +-94, +-93, +-93, +-93, +-92, +-91, +-92, +-93, +-93, +-93, +-93, +-95, +-94, +-94, +-96, +-94, +-91, +-91, +-95, +-94, +-95, +-98, +-98, +-102, +-119, +101, +71, +55, +47, +47, +48, +51, +52, +45, +38, +34, +30, +34, +34, +32, +34, +34, +37, +37, +37, +38, +38, +38, +41, +42, +41, +39, +41, +39, +37, +37, +37, +44, +66, +105, +-118, +-105, +-107, +-106, +-102, +-101, +-102, +-100, +-101, +-101, +-99, +-98, +-96, +-96, +-98, +-94, +-94, +-95, +-94, +-96, +-97, +-97, +-96, +-96, +-95, +-96, +-94, +-96, +-99, +-95, +-96, +-98, +-100, +-98, +-97, +-97, +-94, +-93, +-97, +-107, +123, +83, +54, +41, +45, +48, +45, +46, +44, +43, +40, +36, +39, +36, +37, +38, +40, +41, +40, +37, +37, +38, +38, +38, +40, +40, +43, +43, +41, +40, +42, +42, +40, +44, +61, +90, +121, +-122, +-121, +-117, +-113, +-111, +-108, +-104, +-104, +-105, +-106, +-106, +-102, +-103, +-106, +-106, +-107, +-106, +-106, +-104, +-103, +-101, +-100, +-99, +-98, +-99, +-100, +-101, +-98, +-95, +-94, +-94, +-93, +-95, +-95, +-97, +-97, +-98, +-97, +-97, +-115, +98, +58, +40, +42, +46, +46, +47, +48, +45, +43, +42, +40, +39, +36, +34, +35, +36, +38, +37, +37, +37, +38, +38, +37, +41, +41, +42, +43, +40, +41, +40, +40, +42, +51, +68, +78, +81, +81, +81, +85, +85, +87, +88, +89, +93, +96, +97, +100, +98, +101, +105, +109, +110, +113, +116, +116, +117, +118, +119, +120, +121, +126, +-126, +-126, +-123, +-120, +-118, +-117, +-115, +-114, +-113, +-110, +-106, +-108, +-115, +117, +81, +52, +40, +42, +47, +48, +48, +45, +42, +38, +34, +37, +34, +36, +37, +39, +39, +38, +37, +37, +37, +38, +38, +38, +37, +39, +41, +39, +42, +42, +40, +41, +43, +53, +69, +71, +66, +65, +61, +57, +57, +58, +60, +62, +65, +64, +68, +76, +71, +67, +68, +69, +75, +82, +87, +85, +85, +86, +87, +92, +94, +94, +96, +90, +91, +95, +101, +109, +109, +114, +115, +119, +123, +121, +117, +104, +77, +50, +37, +32, +30, +24, +27, +35, +39, +39, +36, +38, +36, +37, +36, +34, +33, +32, +37, +37, +37, +37, +38, +37, +41, +40, +41, +43, +41, +39, +38, +40, +43, +49, +53, +52, +50, +50, +51, +51, +52, +54, +49, +46, +50, +48, +47, +51, +51, +50, +48, +50, +50, +50, +50, +50, +51, +51, +52, +52, +56, +57, +58, +59, +57, +56, +56, +55, +52, +53, +56, +59, +60, +61, +62, +59, +54, +54, +51, +47, +50, +47, +45, +44, +43, +40, +37, +37, +37, +39, +43, +45, +43, +39, +36, +37, +37, +37, +39, +46, +41, +38, +40, +40, +39, +40, +40, +38, +43, +49, +54, +54, +52, +52, +49, +47, +47, +50, +48, +49, +52, +49, +50, +51, +48, +48, +49, +49, +49, +51, +50, +46, +46, +50, +49, +52, +52, +47, +48, +51, +52, +48, +50, +52, +47, +45, +46, +45, +48, +49, +50, +48, +44, +45, +48, +50, +47, +43, +44, +44, +44, +43, +43, +43, +41, +41, +41, +38, +36, +36, +36, +37, +37, +37, +37, +41, +41, +39, +38, +38, +36, +36, +37, +39, +44, +48, +50, +50, +50, +52, +52, +52, +52, +53, +50, +46, +46, +46, +42, +43, +46, +45, +44, +46, +46, +45, +43, +45, +46, +50, +51, +50, +51, +50, +49, +51, +51, +50, +51, +50, +49, +47, +49, +49, +50, +52, +50, +48, +45, +46, +47, +47, +48, +47, +45, +44, +45, +42, +38, +37, +35, +31, +29, +31, +33, +35, +36, +36, +37, +37, +37, +39, +39, +40, +41, +42, +39, +37, +37, +36, +40, +44, +48, +47, +45, +46, +49, +49, +49, +50, +47, +48, +49, +48, +45, +47, +47, +49, +51, +53, +51, +49, +48, +46, +44, +44, +43, +44, +46, +48, +49, +51, +51, +50, +49, +49, +48, +50, +54, +56, +49, +44, +43, +44, +44, +45, +45, +44, +45, +42, +40, +41, +42, +41, +38, +36, +37, +41, +46, +43, +40, +37, +36, +36, +37, +37, +37, +40, +41, +40, +39, +39, +36, +35, +37, +38, +41, +43, +45, +46, +46, +46, +47, +45, +41, +45, +46, +47, +48, +47, +45, +44, +45, +47, +46, +46, +46, +45, +46, +45, +43, +44, +44, +46, +51, +51, +47, +49, +46, +44, +43, +39, +39, +42, +46, +46, +46, +44, +43, +42, +42, +44, +44, +46, +46, +47, +45, +40, +37, +33, +35, +40, +45, +42, +42, +42, +38, +36, +36, +36, +36, +37, +38, +42, +42, +40, +39, +38, +38, +39, +40, +39, +38, +40, +40, +38, +37, +38, +40, +40, +38, +39, +39, +40, +39, +36, +34, +37, +40, +40, +41, +40, +38, +35, +36, +40, +39, +38, +36, +36, +37, +39, +40, +40, +40, +41, +42, +42, +42, +42, +40, +41, +41, +42, +45, +45, +42, +42, +40, +42, +46, +46, +44, +43, +41, +39, +37, +40, +41, +37, +35, +32, +30, +31, +36, +36, +36, +36, +37, +40, +40, +40, +39, +39, +38, +39, +41, +42, +40, +42, +42, +41, +38, +38, +42, +39, +37, +39, +37, +34, +35, +36, +39, +39, +41, +41, +39, +39, +36, +35, +35, +37, +41, +45, +48, +47, +48, +45, +42, +44, +41, +41, +42, +43, +42, +41, +40, +39, +37, +37, +37, +38, +38, +40, +41, +42, +40, +41, +40, +39, +40, +38, +37, +39, +41, +40, +37, +35, +32, +33, +36, +36, +36, +36, +36, +38, +39, +38, +37, +38, +37, +37, +40, +39, +43, +48, +48, +44, +39, +38, +40, +41, +41, +41, +42, +42, +39, +36, +35, +35, +34, +35, +36, +38, +38, +37, +39, +38, +36, +36, +37, +39, +40, +40, +38, +38, +37, +35, +36, +33, +34, +37, +36, +39, +39, +38, +37, +33, +30, +32, +33, +33, +35, +36, +36, +36, +37, +35, +37, +39, +40, +36, +35, +37, +36, +35, +36, +36, +36, +36, +35, +31, +34, +35, +37, +38, +37, +36, +39, +42, +41, +41, +40, +38, +36, +37, +38, +39, +40, +40, +37, +34, +34, +35, +37, +37, +39, +39, +38, +40, +39, +41, +43, +43, +43, +40, +39, +41, +41, +39, +35, +33, +34, +33, +36, +38, +40, +40, +39, +40, +37, +39, +37, +34, +33, +34, +35, +35, +35, +35, +33, +35, +34, +33, +34, +36, +37, +36, +35, +35, +34, +35, +36, +36, +36, +36, +36, +38, +39, +40, +40, +42, +41, +40, +43, +42, +39, +38, +35, +35, +34, +35, +37, +37, +37, +37, +38, +37, +35, +34, +36, +39, +40, +39, +40, +41, +40, +36, +37, +38, +34, +35, +36, +37, +39, +40, +37, +37, +37, +34, +34, +35, +35, +37, +37, +38, +39, +42, +44, +42, +40, +41, +40, +38, +35, +34, +34, +36, +36, +37, +39, +38, +40, +40, +38, +36, +33, +31, +36, +36, +36, +36, +36, +36, +36, +39, +41, +42, +41, +40, +38, +38, +37, +37, +41, +40, +39, +39, +37, +39, +38, +39, +37, +35, +35, +35, +36, +39, +38, +38, +38, +38, +39, +39, +39, +38, +38, +39, +40, +41, +41, +41, +38, +38, +37, +37, +36, +38, +40, +39, +37, +35, +37, +35, +33, +34, +35, +38, +36, +36, +38, +34, +33, +35, +36, +35, +37, +39, +38, +38, +38, +37, +34, +31, +36, +36, +36, +36, +36, +37, +41, +41, +39, +40, +39, +40, +41, +42, +40, +35, +35, +36, +34, +36, +38, +38, +39, +39, +39, +39, +38, +37, +38, +38, +36, +34, +35, +40, +44, +43, +46, +47, +40, +35, +36, +36, +37, +37, +35, +36, +37, +35, +36, +38, +38, +39, +39, +39, +40, +40, +38, +33, +32, +35, +36, +35, +32, +31, +32, +34, +34, +35, +38, +39, +38, +37, +35, +36, +36, +33, +36, +36, +36, +36, +36, +35, +31, +33, +36, +36, +37, +37, +37, +38, +38, +39, +41, +39, +36, +36, +36, +35, +37, +34, +34, +32, +32, +34, +35, +39, +38, +38, +39, +38, +38, +38, +38, +36, +33, +34, +33, +34, +34, +37, +40, +40, +40, +37, +35, +37, +38, +37, +35, +35, +36, +37, +38, +41, +43, +42, +37, +36, +40, +39, +41, +43, +41, +36, +32, +33, +36, +37, +40, +39, +36, +33, +36, +36, +36, +36, +37, +42, +42, +39, +35, +35, +35, +37, +37, +38, +39, +38, +40, +40, +39, +44, +44, +39, +40, +40, +42, +44, +42, +38, +38, +36, +35, +35, +35, +38, +38, +35, +33, +36, +35, +35, +37, +38, +39, +38, +38, +38, +37, +36, +33, +33, +33, +34, +37, +38, +39, +40, +36, +31, +33, +36, +34, +37, +35, +34, +36, +37, +38, +38, +37, +37, +35, +33, +35, +39, +36, +34, +36, +36, +36, +36, +36, +36, +35, +36, +36, +37, +35, +37, +38, +38, +40, +41, +42, +40, +41, +44, +42, +42, +40, +38, +39, +37, +36, +35, +35, +34, +33, +34, +35, +36, +36, +38, +37, +37, +36, +34, +36, +39, +40, +39, +38, +39, +37, +37, +36, +39, +40, +39, +39, +35, +37, +37, +36, +40, +41, +40, +37, +35, +36, +36, +37, +35, +35, +34, +32, +36, +34, +32, +31, +30, +31, +33, +36, +36, +36, +36, +37, +37, +37, +36, +35, +38, +39, +41, +40, +35, +36, +35, +35, +34, +34, +38, +38, +39, +40, +36, +35, +36, +35, +36, +36, +38, +36, +39, +41, +42, +41, +41, +40, +41, +41, +39, +38, +36, +37, +37, +35, +37, +40, +39, +37, +37, +37, +38, +39, +43, +44, +41, +39, +39, +42, +40, +36, +38, +34, +33, +36, +37, +41, +41, +41, +41, +41, +40, +40, +44, +41, +38, +36, +36, +36, +37, +37, +38, +39, +39, +38, +38, +37, +40, +40, +37, +38, +38, +37, +36, +36, +36, +35, +39, +39, +38, +41, +38, +37, +38, +39, +41, +40, +40, +41, +41, +41, +40, +37, +39, +40, +40, +39, +39, +36, +35, +35, +35, +35, +35, +34, +36, +35, +37, +40, +40, +40, +38, +36, +36, +35, +37, +36, +37, +38, +38, +38, +37, +37, +34, +31, +33, +32, +33, +33, +33, +35, +36}; diff --git a/all_pairs/source/susan/math_private.h b/all_pairs/source/susan/math_private.h new file mode 100644 index 0000000..58d4354 --- /dev/null +++ b/all_pairs/source/susan/math_private.h @@ -0,0 +1,178 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * from: @(#)fdlibm.h 5.1 93/09/24 + */ + +#ifndef _MATH_PRIVATE_H_ +#define _MATH_PRIVATE_H_ + +#include "wcclibm.h" + +//#include +//#include + +/* A representation of a double as a union. */ +union ieee754_double +{ + double d; + + /* This is the IEEE 754 double-precision format. */ + struct { + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:20; + unsigned int exponent:11; + unsigned int negative:1; + } ieee; + + /* This format makes it easier to see if a NaN is a signalling NaN. */ + struct { + /* Together these comprise the mantissa. */ + unsigned int mantissa1:32; + unsigned int mantissa0:19; + unsigned int quiet_nan:1; + unsigned int exponent:11; + unsigned int negative:1; + } ieee_nan; +}; + +/* The original fdlibm code used statements like: + n0 = ((*(int*)&one)>>29)^1; * index of high word * + ix0 = *(n0+(int*)&x); * high word of x * + ix1 = *((1-n0)+(int*)&x); * low word of x * + to dig two 32 bit words out of the 64 bit IEEE floating point + value. That is non-ANSI, and, moreover, the gcc instruction + scheduler gets it wrong. We instead use the following macros. + Unlike the original code, we determine the endianness at compile + time, not at run time; I don't see much benefit to selecting + endianness at run time. */ + +/* A union which permits us to convert between a double and two 32 bit + ints. */ + +/* #if __FLOAT_WORD_ORDER == BIG_ENDIAN */ +/* #warning USING Big Endian float word order */ +/* typedef union */ +/* { */ +/* double value; */ +/* struct */ +/* { */ +/* u_int16_t msw; */ +/* u_int16_t lsw; */ +/* } parts; */ +/* } ieeeDoubleShapeType; */ + +/* #endif */ + +/* #if __FLOAT_WORD_ORDER == LITTLE_ENDIAN */ +/* #warning USING Little Endian float word order */ + +typedef union +{ + double value; + struct + { + u_int16_t lsw; + u_int16_t msw; + } parts; +} ieeeDoubleShapeType; + +/* #endif */ + +/* Get two 32 bit ints from a double. */ + +#define EXTRACT_WORDS(ix0,ix1,d) \ +{ \ + ieeeDoubleShapeType ew_u; \ + ew_u.value = (d); \ + (ix0) = ew_u.parts.msw; \ + (ix1) = ew_u.parts.lsw; \ +} + +/* Get the more significant 32 bit int from a double. */ + +#define GET_HIGH_WORD(i,d) \ +{ \ + ieeeDoubleShapeType gh_u; \ + gh_u.value = (d); \ + (i) = gh_u.parts.msw; \ +} + +/* Get the less significant 32 bit int from a double. */ + +#define GET_LOW_WORD(i,d) \ +{ \ + ieeeDoubleShapeType gl_u; \ + gl_u.value = (d); \ + (i) = gl_u.parts.lsw; \ +} + +/* Set a double from two 32 bit ints. */ + +#define INSERT_WORDS(d,ix0,ix1) \ +{ \ + ieeeDoubleShapeType iw_u; \ + iw_u.parts.msw = (ix0); \ + iw_u.parts.lsw = (ix1); \ + (d) = iw_u.value; \ +} + +/* Set the more significant 32 bits of a double from an int. */ + +#define SET_HIGH_WORD(d,v) \ +{ \ + ieeeDoubleShapeType sh_u; \ + sh_u.value = (d); \ + sh_u.parts.msw = (v); \ + (d) = sh_u.value; \ +} + +/* Set the less significant 32 bits of a double from an int. */ + +#define SET_LOW_WORD(d,v) \ +{ \ + ieeeDoubleShapeType sl_u; \ + sl_u.value = (d); \ + sl_u.parts.lsw = (v); \ + (d) = sl_u.value; \ +} + +/* A union which permits us to convert between a float and a 32 bit + int. */ + +typedef union +{ + float value; + u_int32_t word; +} ieee_float_shape_type; + +/* Get a 32 bit int from a float. */ + +#define GET_FLOAT_WORD(i,d) \ +{ \ + ieee_float_shape_type gf_u; \ + gf_u.value = (d); \ + (i) = gf_u.word; \ +} + +/* Set a float from a 32 bit int. */ + +#define SET_FLOAT_WORD(d,i) \ +{ \ + ieee_float_shape_type sf_u; \ + sf_u.word = (i); \ + (d) = sf_u.value; \ +} + + +#endif /* _MATH_PRIVATE_H_ */ diff --git a/all_pairs/source/susan/susan.c b/all_pairs/source/susan/susan.c new file mode 100644 index 0000000..fb990b1 --- /dev/null +++ b/all_pairs/source/susan/susan.c @@ -0,0 +1,2014 @@ +/**********************************************************************\ + + SUSAN Version 2l by Stephen Smith + Oxford Centre for Functional Magnetic Resonance Imaging of the Brain, + Department of Clinical Neurology, Oxford University, Oxford, UK + (Previously in Computer Vision and Image Processing Group - now + Computer Vision and Electro Optics Group - DERA Chertsey, UK) + Email: steve@fmrib.ox.ac.uk + WWW: http://www.fmrib.ox.ac.uk/~steve + + (C) Crown Copyright (1995-1999), Defence Evaluation and Research Agency, + Farnborough, Hampshire, GU14 6TD, UK + DERA WWW site: + http://www.dera.gov.uk/ + DERA Computer Vision and Electro Optics Group WWW site: + http://www.dera.gov.uk/imageprocessing/dera/group_home.html + DERA Computer Vision and Electro Optics Group point of contact: + Dr. John Savage, jtsavage@dera.gov.uk, +44 1344 633203 + + A UK patent has been granted: "Method for digitally processing + images to determine the position of edges and/or corners therein for + guidance of unmanned vehicle", UK Patent 2272285. Proprietor: + Secretary of State for Defence, UK. 15 January 1997 + + This code is issued for research purposes only and remains the + property of the UK Secretary of State for Defence. This code must + not be passed on without this header information being kept + intact. This code must not be sold. + +\**********************************************************************/ + +/**********************************************************************\ + + SUSAN Version 2l + SUSAN = Smallest Univalue Segment Assimilating Nucleus + + Email: steve@fmrib.ox.ac.uk + WWW: http://www.fmrib.ox.ac.uk/~steve + + Related paper: + @article{Smith97, + author = "Smith, S.M. and Brady, J.M.", + title = "{SUSAN} - A New Approach to Low Level Image Processing", + journal = "Int. Journal of Computer Vision", + pages = "45--78", + volume = "23", + number = "1", + month = "May", + year = 1997} + + To be registered for automatic (bug) updates of SUSAN, send an email. + + Compile with: + gcc -O4 -o susan susan2l.c -lm + + See following section for different machine information. Please + report any bugs (and fixes). There are a few optional changes that + can be made in the "defines" section which follows shortly. + + Usage: type "susan" to get usage. Only PGM format files can be input + and output. Utilities such as the netpbm package and XV can be used + to convert to and from other formats. Any size of image can be + processed. + + This code is written using an emacs folding mode, making moving + around the different sections very easy. This is why there are + various marks within comments and why comments are indented. + + + SUSAN QUICK: + + This version of the SUSAN corner finder does not do all the + false-corner suppression and thus is faster and produced some false + positives, particularly on strong edges. However, because there are + less stages involving thresholds etc., the corners that are + correctly reported are usually more stable than those reported with + the full algorithm. Thus I recommend at least TRYING this algorithm + for applications where stability is important, e.g., tracking. + + THRESHOLDS: + + There are two thresholds which can be set at run-time. These are the + brightness threshold (t) and the distance threshold (d). + + SPATIAL CONTROL: d + + In SUSAN smoothing d controls the size of the Gaussian mask; its + default is 4.0. Increasing d gives more smoothing. In edge finding, + a fixed flat mask is used, either 37 pixels arranged in a "circle" + (default), or a 3 by 3 mask which gives finer detail. In corner + finding, only the larger 37 pixel mask is used; d is not + variable. In smoothing, the flat 3 by 3 mask can be used instead of + a larger Gaussian mask; this gives low smoothing and fast operation. + + BRIGHTNESS CONTROL: t + + In all three algorithms, t can be varied (default=20); this is the + main threshold to be varied. It determines the maximum difference in + greylevels between two pixels which allows them to be considered + part of the same "region" in the image. Thus it can be reduced to + give more edges or corners, i.e. to be more sensitive, and vice + versa. In smoothing, reducing t gives less smoothing, and vice + versa. Set t=10 for the test image available from the SUSAN web + page. + + ITERATIONS: + + With SUSAN smoothing, more smoothing can also be obtained by + iterating the algorithm several times. This has a different effect + from varying d or t. + + FIXED MASKS: + + 37 pixel mask: ooo 3 by 3 mask: ooo + ooooo ooo + ooooooo ooo + ooooooo + ooooooo + ooooo + ooo + + CORNER ATTRIBUTES dx, dy and I + (Only read this if you are interested in the C implementation or in + using corner attributes, e.g., for corner matching) + + Corners reported in the corner list have attributes associated with + them as well as positions. This is useful, for example, when + attempting to match corners from one image to another, as these + attributes can often be fairly unchanged between images. The + attributes are dx, dy and I. I is the value of image brightness at + the position of the corner. In the case of susan_corners_quick, dx + and dy are the first order derivatives (differentials) of the image + brightness in the x and y directions respectively, at the position + of the corner. In the case of normal susan corner finding, dx and dy + are scaled versions of the position of the centre of gravity of the + USAN with respect to the centre pixel (nucleus). + + BRIGHTNESS FUNCTION LUT IMPLEMENTATION: + (Only read this if you are interested in the C implementation) + + The SUSAN brightness function is implemented as a LUT + (Look-Up-Table) for speed. The resulting pointer-based code is a + little hard to follow, so here is a brief explanation. In + setup_brightness_lut() the LUT is setup. This mallocs enough space + for *bp and then repositions the pointer to the centre of the + malloced space. The SUSAN function e^-(x^6) or e^-(x^2) is + calculated and converted to a uchar in the range 0-100, for all + possible image brightness differences (including negative + ones). Thus bp[23] is the output for a brightness difference of 23 + greylevels. In the SUSAN algorithms this LUT is used as follows: + + p=in + (i-3)*x_size + j - 1; + p points to the first image pixel in the circular mask surrounding + point (x,y). + + cp=bp + in[i*x_size+j]; + cp points to a position in the LUT corresponding to the brightness + of the centre pixel (x,y). + + now for every pixel within the mask surrounding (x,y), + n+=*(cp-*p++); + the brightness difference function is found by moving the cp pointer + down by an amount equal to the value of the pixel pointed to by p, + thus subtracting the two brightness values and performing the + exponential function. This value is added to n, the running USAN + area. + + in SUSAN smoothing, the variable height mask is implemented by + multiplying the above by the moving mask pointer, reset for each new + centre pixel. + tmp = *dpt++ * *(cp-brightness); + +\**********************************************************************/ + +/**********************************************************************\ + + Success has been reported with the following: + + MACHINE OS COMPILER + + Sun 4.1.4 bundled C, gcc + + Next + + SGI IRIX SGI cc + + DEC Unix V3.2+ + + IBM RISC AIX gcc + + PC Borland 5.0 + + PC Linux gcc-2.6.3 + + PC Win32 Visual C++ 4.0 (Console Application) + + PC Win95 Visual C++ 5.0 (Console Application) + Thanks to Niu Yongsheng : + Use the FOPENB option below + + PC DOS djgpp gnu C + Thanks to Mark Pettovello : + Use the FOPENB option below + + HP HP-UX bundled cc + Thanks to Brian Dixon : + in ksh: + export CCOPTS="-Aa -D_HPUX_SOURCE | -lM" + cc -O3 -o susan susan2l.c + +\**********************************************************************/ + +/**********************************************************************\ + + SUSAN Version 2l, 12/2/99 + Changed GNUDOS option to FOPENB. + (Thanks to Niu Yongsheng .) + Took out redundant "sq=sq/2;". + + SUSAN Version 2k, 19/8/98: + In corner finding: + Changed if(yyx_size) etc. tests in smoothing. + Added a couple of free() calls for cgx and cgy. + (Thanks to geoffb@ucs.ed.ac.uk - Geoff Browitt.) + + SUSAN Version 2i, 21/7/97: + Added information about corner attributes. + + SUSAN Version 2h, 16/12/96: + Added principle (initial enhancement) option. + + SUSAN Version 2g, 2/7/96: + Minor superficial changes to code. + + SUSAN Version 2f, 16/1/96: + Added GNUDOS option (now called FOPENB; see options below). + + SUSAN Version 2e, 9/1/96: + Added -b option. + Fixed 1 pixel horizontal offset error for drawing edges. + + SUSAN Version 2d, 27/11/95: + Fixed loading of certain PGM files in get_image (again!) + + SUSAN Version 2c, 22/11/95: + Fixed loading of certain PGM files in get_image. + (Thanks to qu@San-Jose.ate.slb.com - Gongyuan Qu.) + + SUSAN Version 2b, 9/11/95: + removed "z==" error in edges routines. + + SUSAN Version 2a, 6/11/95: + Removed a few unnecessary variable declarations. + Added different machine information. + Changed "header" in get_image to char. + + SUSAN Version 2, 1/11/95: first combined version able to take any + image sizes. + + SUSAN "Versions 1", circa 1992: the various SUSAN algorithms were + developed during my doctorate within different programs and for + fixed image sizes. The algorithms themselves are virtually unaltered + between "versions 1" and the combined program, version 2. + +\**********************************************************************/ + +#include "../extra.h" +#include "wcclibm.h" +#include "wccfile.h" +#include "wccmalloc.h" + +#define EXP_A 184 +#define EXP_C 16249 + +float susan_expf(float y) +{ + union + { + float d; + struct + { +#ifdef LITTLE_ENDIAN + short j, i; +#else + short i, j; +#endif + } n; + } eco; + eco.n.i = EXP_A*(y) + (EXP_C); + eco.n.j = 0; + return eco.d; +} + +float susan_sqrtf(float val) +{ + float x = val/10; + + float dx; + + float diff; + float min_tol = 0.00001f; + + int i, flag; + + + flag = 0; + if (val == 0 ) x = 0; + else { + for (i=1;i<20;i++) + { + if (!flag) { + dx = (val - (x*x)) / (2.0f * x); + x = x + dx; + diff = val - (x*x); + if (fabs(diff) <= min_tol) flag = 1; + } + } + } + return (x); +} + +/* ********** Optional settings */ + +typedef int TOTAL_TYPE; + +#define SEVEN_SUPP /* size for non-max corner suppression; SEVEN_SUPP or FIVE_SUPP */ +#define MAX_CORNERS 15000 /* max corners per frame */ + +#define FTOI(a) ( (a) < 0 ? ((int)(a-0.5)) : ((int)(a+0.5)) ) +#define abs(a) ( (a) < 0 ? -a : a ) +typedef unsigned char uchar; +typedef struct {int x,y,info, dx, dy, I;} corner_rep; +typedef corner_rep CORNER_LIST[MAX_CORNERS]; + +extern char susan_input[7292]; +struct wccFILE susan_file; +float susan_dt; +int susan_bt; +int susan_principle_conf; +int susan_thin_post_proc; +int susan_three_by_three; +int susan_drawing_mode; +int susan_susan_quick; +int susan_max_no_corners; +int susan_max_no_edges; + +int susan_getint( struct wccFILE *fd ) +{ + int c, i; + char dummy[10000]; + + c = susan_wccfgetc(fd); + _Pragma( "loopbound min 1 max 4" ) + while (1) { /* find next integer */ + if (c=='#') /* if we're at a comment, read to end of line */ + susan_wccfgets(dummy,9000,fd); + if (c==EOFX) { + /* "Image is not binary PGM." */ + } + if (c>='0' && c<='9') + break; /* found what we were looking for */ + c = susan_wccfgetc(fd); + } + + /* we're at the start of a number, continue until we hit a non-number */ + i = 0; + _Pragma( "loopbound min 2 max 3" ) + while (1) { + i = (i*10) + (c - '0'); + c = susan_wccfgetc(fd); + if (c==EOFX) return (i); + if (c<'0' || c>'9') break; + } + + return (i); +} + + +void susan_get_image( struct wccFILE *fd, + unsigned char **in, int *x_size, int *y_size ) +{ + char header [100]; + + susan_wccfseek( fd, 0, WCCSEEK_SET ); + + /* {{{ read header */ + + header[0]=susan_wccfgetc( fd ); + header[1]=susan_wccfgetc( fd ); + if(!(header[0]=='P' && header[1]=='5')) { + /* "Image does not have binary PGM header." */ + } + + *x_size = susan_getint(fd); + *y_size = susan_getint(fd); + // dummy read + susan_getint(fd); + +/* }}} */ + + *in = (uchar *) susan_wccmalloc(*x_size * *y_size); + + if (susan_wccfread(*in,1,*x_size * *y_size,fd) == 0) { + /* "Image is wrong size.\n" */ + } +} + + +void susan_put_image( int x_size, int y_size ) +{ + int i; + _Pragma( "loopbound min 7220 max 7220" ) + for ( i = 0; i < x_size*y_size; i++ ) { + ; + } +} + + +void susan_int_to_uchar( char *r, uchar *in, int size ) +{ + int i, max_r=r[0], min_r=r[0]; + + _Pragma( "loopbound min 0 max 0" ) + for (i=0; i max_r ) + max_r=r[i]; + if ( r[i] < min_r ) + min_r=r[i]; + } + + if (max_r == min_r) { + /* Should not occur in TACLeBench. */ + _Pragma( "loopbound min 0 max 0" ) + for (i=0; ip[l+1]) { + tmp=p[l]; + p[l]=p[l+1]; + p[l+1]=tmp; + } + } + } + + return( (p[3]+p[4]) / 2 ); +} + + +/* this enlarges "in" so that borders can be dealt with easily */ +void susan_enlarge( uchar **in, uchar *tmp_image, + int *x_size, int *y_size, int border ) +{ + int i, j; + + _Pragma( "loopbound min 95 max 95" ) + for(i=0; i<*y_size; i++) { /* copy *in into tmp_image */ + susan_wccmemcpy( tmp_image+(i+border)*(*x_size+2*border)+border, + *in+i* *x_size, *x_size); + } + + _Pragma( "loopbound min 7 max 7" ) + for(i=0; i15 ) { + /* "Distance_thresh too big for integer arithmetic." */ + // Either reduce it to <=15 or recompile with variable "total" + // as a float: see top "defines" section. + } + + if ( (2*mask_size+1>x_size) || (2*mask_size+1>y_size) ) { + /* "Mask size too big for image." */ + } + + tmp_image = (uchar *)susan_wccmalloc( (x_size+mask_size*2) * (y_size+mask_size*2) ); + susan_enlarge(&in,tmp_image,&x_size,&y_size,mask_size); + + if (three_by_three==0) { + /* large Gaussian masks */ + /* {{{ setup distance lut */ + + n_max = (mask_size*2) + 1; + + increment = x_size - n_max; + + dp = (unsigned char *)susan_wccmalloc(n_max*n_max); + dpt = dp; + temp = -(dt*dt); + + _Pragma( "loopbound min 15 max 15" ) + for(i=-mask_size; i<=mask_size; i++) { + _Pragma( "loopbound min 15 max 15" ) + for(j=-mask_size; j<=mask_size; j++) { + x = (int) (100.0 * susan_expf( ((float)((i*i)+(j*j))) / temp )); + *dpt++ = (unsigned char)x; + } + } + + /* {{{ main section */ + + _Pragma( "loopbound min 95 max 95" ) + for (i=mask_size;im) { m=l[y+y+y+x]; a=y; b=x; } + + if (m>0) { + if (mid[i*x_size+j]<4) + mid[(i+a-1)*x_size+j+b-1] = 4; + else + mid[(i+a-1)*x_size+j+b-1] = mid[i*x_size+j]+1; + if ( (a+a+b) < 3 ) { /* need to jump back in image */ + i+=a-1; + j+=b-2; + if (i<4) i=4; + if (j<4) j=4; + } + } + } + + /* {{{ n==2 */ + + if (n==2) { + /* put in a bit here to straighten edges */ + b00 = mid[(i-1)*x_size+j-1]<8; /* corners of 3x3 */ + b02 = mid[(i-1)*x_size+j+1]<8; + b20 = mid[(i+1)*x_size+j-1]<8; + b22 = mid[(i+1)*x_size+j+1]<8; + if ( ((b00+b02+b20+b22)==2) && ((b00|b22)&(b02|b20))) { + /* case: move a point back into line. + e.g. X O X CAN become X X X + O X O O O O + O O O O O O */ + if (b00) { + if (b02) { x=0; y=-1; } + else { x=-1; y=0; } + } else { + if (b02) { x=1; y=0; } + else { x=0; y=1; } + } + if (((float)r[(i+y)*x_size+j+x]/(float)centre) > 0.7) { + if ( ( (x==0) && (mid[(i+(2*y))*x_size+j]>7) && (mid[(i+(2*y))*x_size+j-1]>7) && (mid[(i+(2*y))*x_size+j+1]>7) ) || + ( (y==0) && (mid[(i)*x_size+j+(2*x)]>7) && (mid[(i+1)*x_size+j+(2*x)]>7) && (mid[(i-1)*x_size+j+(2*x)]>7) ) ) { + mid[(i)*x_size+j]=100; + mid[(i+y)*x_size+j+x]=3; /* no jumping needed */ + } + } + } else { + b01 = mid[(i-1)*x_size+j ]<8; + b12 = mid[(i )*x_size+j+1]<8; + b21 = mid[(i+1)*x_size+j ]<8; + b10 = mid[(i )*x_size+j-1]<8; + /* {{{ right angle ends - not currently used */ + +#ifdef IGNORETHIS + if ( (b00&b01)|(b00&b10)|(b02&b01)|(b02&b12)|(b20&b10)|(b20&b21)|(b22&b21)|(b22&b12) ) { + /* case; right angle ends. clean up. + e.g.; X X O CAN become X X O + O X O O O O + O O O O O O */ + if ( ((b01)&(mid[(i-2)*x_size+j-1]>7)&(mid[(i-2)*x_size+j]>7)&(mid[(i-2)*x_size+j+1]>7)& + ((b00&((2*r[(i-1)*x_size+j+1])>centre))|(b02&((2*r[(i-1)*x_size+j-1])>centre)))) | + ((b10)&(mid[(i-1)*x_size+j-2]>7)&(mid[(i)*x_size+j-2]>7)&(mid[(i+1)*x_size+j-2]>7)& + ((b00&((2*r[(i+1)*x_size+j-1])>centre))|(b20&((2*r[(i-1)*x_size+j-1])>centre)))) | + ((b12)&(mid[(i-1)*x_size+j+2]>7)&(mid[(i)*x_size+j+2]>7)&(mid[(i+1)*x_size+j+2]>7)& + ((b02&((2*r[(i+1)*x_size+j+1])>centre))|(b22&((2*r[(i-1)*x_size+j+1])>centre)))) | + ((b21)&(mid[(i+2)*x_size+j-1]>7)&(mid[(i+2)*x_size+j]>7)&(mid[(i+2)*x_size+j+1]>7)& + ((b20&((2*r[(i+1)*x_size+j+1])>centre))|(b22&((2*r[(i+1)*x_size+j-1])>centre)))) ) { + mid[(i)*x_size+j]=100; + if (b10&b20) j-=2; + if (b00|b01|b02) { i--; j-=2; } + } + } +#endif + + if ( ((b01+b12+b21+b10)==2) && ((b10|b12)&(b01|b21)) && + ((b01&((mid[(i-2)*x_size+j-1]<8)|(mid[(i-2)*x_size+j+1]<8)))|(b10&((mid[(i-1)*x_size+j-2]<8)|(mid[(i+1)*x_size+j-2]<8)))| + (b12&((mid[(i-1)*x_size+j+2]<8)|(mid[(i+1)*x_size+j+2]<8)))|(b21&((mid[(i+2)*x_size+j-1]<8)|(mid[(i+2)*x_size+j+1]<8)))) ) { + /* case; clears odd right angles. + e.g.; O O O becomes O O O + X X O X O O + O X O O X O */ + mid[(i)*x_size+j]=100; + i--; /* jump back */ + j-=2; + if (i<4) i=4; + if (j<4) j=4; + } + } + } + + /* {{{ n>2 the thinning is done here without breaking connectivity */ + + if (n>2) { + b01 = mid[(i-1)*x_size+j ]<8; + b12 = mid[(i )*x_size+j+1]<8; + b21 = mid[(i+1)*x_size+j ]<8; + b10 = mid[(i )*x_size+j-1]<8; + if((b01+b12+b21+b10)>1) { + b00 = mid[(i-1)*x_size+j-1]<8; + b02 = mid[(i-1)*x_size+j+1]<8; + b20 = mid[(i+1)*x_size+j-1]<8; + b22 = mid[(i+1)*x_size+j+1]<8; + p1 = b00 | b01; + p2 = b02 | b12; + p3 = b22 | b21; + p4 = b20 | b10; + + if( ((p1 + p2 + p3 + p4) - ((b01 & p2)+(b12 & p3)+(b21 & p4)+(b10 & p1))) < 2) { + mid[(i)*x_size+j]=100; + i--; + j-=2; + if (i<4) i=4; + if (j<4) j=4; + } + } + } + } + } + } +} + + +void susan_edges( uchar *in, char *r, uchar *mid, uchar *bp, + int max_no, int x_size, int y_size ) +{ + float z; + int do_symmetry, i, j, m, n, a, b, x, y, w; + uchar c,*p,*cp; + + susan_wccmemset(r,0,x_size * y_size); + + _Pragma( "loopbound min 89 max 89" ) + for (i=3;i0) { + m=r[i*x_size+j]; + n=max_no - m; + cp=bp + in[i*x_size+j]; + + if (n>600) { + p=in + (i-3)*x_size + j - 1; + x=0;y=0; + + c=*(cp-*p++);x-=c;y-=3*c; + c=*(cp-*p++);y-=3*c; + c=*(cp-*p);x+=c;y-=3*c; + p+=x_size-3; + + c=*(cp-*p++);x-=2*c;y-=2*c; + c=*(cp-*p++);x-=c;y-=2*c; + c=*(cp-*p++);y-=2*c; + c=*(cp-*p++);x+=c;y-=2*c; + c=*(cp-*p);x+=2*c;y-=2*c; + p+=x_size-5; + + c=*(cp-*p++);x-=3*c;y-=c; + c=*(cp-*p++);x-=2*c;y-=c; + c=*(cp-*p++);x-=c;y-=c; + c=*(cp-*p++);y-=c; + c=*(cp-*p++);x+=c;y-=c; + c=*(cp-*p++);x+=2*c;y-=c; + c=*(cp-*p);x+=3*c;y-=c; + p+=x_size-6; + + c=*(cp-*p++);x-=3*c; + c=*(cp-*p++);x-=2*c; + c=*(cp-*p);x-=c; + p+=2; + c=*(cp-*p++);x+=c; + c=*(cp-*p++);x+=2*c; + c=*(cp-*p);x+=3*c; + p+=x_size-6; + + c=*(cp-*p++);x-=3*c;y+=c; + c=*(cp-*p++);x-=2*c;y+=c; + c=*(cp-*p++);x-=c;y+=c; + c=*(cp-*p++);y+=c; + c=*(cp-*p++);x+=c;y+=c; + c=*(cp-*p++);x+=2*c;y+=c; + c=*(cp-*p);x+=3*c;y+=c; + p+=x_size-5; + + c=*(cp-*p++);x-=2*c;y+=2*c; + c=*(cp-*p++);x-=c;y+=2*c; + c=*(cp-*p++);y+=2*c; + c=*(cp-*p++);x+=c;y+=2*c; + c=*(cp-*p);x+=2*c;y+=2*c; + p+=x_size-3; + + c=*(cp-*p++);x-=c;y+=3*c; + c=*(cp-*p++);y+=3*c; + c=*(cp-*p);x+=c;y+=3*c; + + z = susan_sqrtf((float)((x*x) + (y*y))); + if (z > (0.9*(float)n)) { /* 0.5 */ + do_symmetry=0; + if (x==0) + z=1000000.0; + else + z=((float)y) / ((float)x); + if (z < 0) { z=-z; w=-1; } + else w=1; + if (z < 0.5) { /* vert_edge */ a=0; b=1; } + else { if (z > 2.0) { /* hor_edge */ a=1; b=0; } + else { /* diag_edge */ if (w>0) { a=1; b=1; } + else { a=-1; b=1; }}} + if ( (m > r[(i+a)*x_size+j+b]) && (m >= r[(i-a)*x_size+j-b]) && + (m > r[(i+(2*a))*x_size+j+(2*b)]) && (m >= r[(i-(2*a))*x_size+j-(2*b)]) ) + mid[i*x_size+j] = 1; + } else { + do_symmetry=1; + } + } else { + do_symmetry=1; + } + + if (do_symmetry==1) { + p=in + (i-3)*x_size + j - 1; + x=0; y=0; w=0; + + /* | \ + y -x- w + | \ */ + + c=*(cp-*p++);x+=c;y+=9*c;w+=3*c; + c=*(cp-*p++);y+=9*c; + c=*(cp-*p);x+=c;y+=9*c;w-=3*c; + p+=x_size-3; + + c=*(cp-*p++);x+=4*c;y+=4*c;w+=4*c; + c=*(cp-*p++);x+=c;y+=4*c;w+=2*c; + c=*(cp-*p++);y+=4*c; + c=*(cp-*p++);x+=c;y+=4*c;w-=2*c; + c=*(cp-*p);x+=4*c;y+=4*c;w-=4*c; + p+=x_size-5; + + c=*(cp-*p++);x+=9*c;y+=c;w+=3*c; + c=*(cp-*p++);x+=4*c;y+=c;w+=2*c; + c=*(cp-*p++);x+=c;y+=c;w+=c; + c=*(cp-*p++);y+=c; + c=*(cp-*p++);x+=c;y+=c;w-=c; + c=*(cp-*p++);x+=4*c;y+=c;w-=2*c; + c=*(cp-*p);x+=9*c;y+=c;w-=3*c; + p+=x_size-6; + + c=*(cp-*p++);x+=9*c; + c=*(cp-*p++);x+=4*c; + c=*(cp-*p);x+=c; + p+=2; + c=*(cp-*p++);x+=c; + c=*(cp-*p++);x+=4*c; + c=*(cp-*p);x+=9*c; + p+=x_size-6; + + c=*(cp-*p++);x+=9*c;y+=c;w-=3*c; + c=*(cp-*p++);x+=4*c;y+=c;w-=2*c; + c=*(cp-*p++);x+=c;y+=c;w-=c; + c=*(cp-*p++);y+=c; + c=*(cp-*p++);x+=c;y+=c;w+=c; + c=*(cp-*p++);x+=4*c;y+=c;w+=2*c; + c=*(cp-*p);x+=9*c;y+=c;w+=3*c; + p+=x_size-5; + + c=*(cp-*p++);x+=4*c;y+=4*c;w-=4*c; + c=*(cp-*p++);x+=c;y+=4*c;w-=2*c; + c=*(cp-*p++);y+=4*c; + c=*(cp-*p++);x+=c;y+=4*c;w+=2*c; + c=*(cp-*p);x+=4*c;y+=4*c;w+=4*c; + p+=x_size-3; + + c=*(cp-*p++);x+=c;y+=9*c;w-=3*c; + c=*(cp-*p++);y+=9*c; + c=*(cp-*p);x+=c;y+=9*c;w+=3*c; + + if (y==0) + z = 1000000.0; + else + z = ((float)x) / ((float)y); + if (z < 0.5) { /* vertical */ a=0; b=1; } + else { if (z > 2.0) { /* horizontal */ a=1; b=0; } + else { /* diagonal */ if (w>0) { a=-1; b=1; } + else { a=1; b=1; }}} + if ( (m > r[(i+a)*x_size+j+b]) && (m >= r[(i-a)*x_size+j-b]) && + (m > r[(i+(2*a))*x_size+j+(2*b)]) && (m >= r[(i-(2*a))*x_size+j-(2*b)]) ) + mid[i*x_size+j] = 2; + } + } + } + } +} + + +void susan_edges_small( uchar *in, char *r, uchar *mid, uchar *bp, + int max_no, int x_size, int y_size ) +{ + float z; + int do_symmetry, i, j, m, n, a, b, x, y, w; + uchar c,*p,*cp; + + susan_wccmemset(r,0,x_size * y_size); + + _Pragma( "loopbound min 0 max 0" ) + for (i=1;i0) { + m=r[i*x_size+j]; + n=max_no - m; + cp=bp + in[i*x_size+j]; + + if (n>250) { + p=in + (i-1)*x_size + j - 1; + x=0;y=0; + + c=*(cp-*p++);x-=c;y-=c; + c=*(cp-*p++);y-=c; + c=*(cp-*p);x+=c;y-=c; + p+=x_size-2; + + c=*(cp-*p);x-=c; + p+=2; + c=*(cp-*p);x+=c; + p+=x_size-2; + + c=*(cp-*p++);x-=c;y+=c; + c=*(cp-*p++);y+=c; + c=*(cp-*p);x+=c;y+=c; + + z = susan_sqrtf((float)((x*x) + (y*y))); + if (z > (0.4*(float)n)) { /* 0.6 */ + do_symmetry=0; + if (x==0) + z=1000000.0; + else + z=((float)y) / ((float)x); + if (z < 0) { z=-z; w=-1; } + else w=1; + if (z < 0.5) { /* vert_edge */ a=0; b=1; } + else { if (z > 2.0) { /* hor_edge */ a=1; b=0; } + else { /* diag_edge */ if (w>0) { a=1; b=1; } + else { a=-1; b=1; } + } + } + if ( (m > r[(i+a)*x_size+j+b]) && (m >= r[(i-a)*x_size+j-b]) ) { + mid[i*x_size+j] = 1; + } + } else { + do_symmetry=1; + } + } else { + do_symmetry=1; + } + + if (do_symmetry==1) { + p=in + (i-1)*x_size + j - 1; + x=0; y=0; w=0; + + /* | \ + y -x- w + | \ */ + + c=*(cp-*p++);x+=c;y+=c;w+=c; + c=*(cp-*p++);y+=c; + c=*(cp-*p);x+=c;y+=c;w-=c; + p+=x_size-2; + + c=*(cp-*p);x+=c; + p+=2; + c=*(cp-*p);x+=c; + p+=x_size-2; + + c=*(cp-*p++);x+=c;y+=c;w-=c; + c=*(cp-*p++);y+=c; + c=*(cp-*p);x+=c;y+=c;w+=c; + + if (y==0) + z = 1000000.0; + else + z = ((float)x) / ((float)y); + if (z < 0.5) { /* vertical */ a=0; b=1; } + else { if (z > 2.0) { /* horizontal */ a=1; b=0; } + else { /* diagonal */ if (w>0) { a=-1; b=1; } + else { a=1; b=1; } + } + } + if ( (m > r[(i+a)*x_size+j+b]) && (m >= r[(i-a)*x_size+j-b]) ) { + mid[i*x_size+j] = 2; + } + } + } + } + } +} + + +void susan_corner_draw( uchar *in, CORNER_LIST corner_list, + int x_size, int drawing_mode) +{ + uchar *p; + int n=0; + + _Pragma( "loopbound min 0 max 0" ) + while(corner_list[n].info != 7) { + if (drawing_mode==0) { + p = in + (corner_list[n].y-1)*x_size + corner_list[n].x - 1; + *p++=255; *p++=255; *p=255; p+=x_size-2; + *p++=255; *p++=0; *p=255; p+=x_size-2; + *p++=255; *p++=255; *p=255; + n++; + } else { + p = in + corner_list[n].y*x_size + corner_list[n].x; + *p=0; + n++; + } + } +} + + +void susan_corners( uchar *in, char *r, uchar *bp, + int max_no, CORNER_LIST corner_list, int x_size, int y_size) +{ + int n,x,y,sq,xx,yy, + i,j; + float divide; + uchar c,*p,*cp; + char *cgx,*cgy; + + susan_wccmemset(r,0,x_size * y_size); + + cgx=(char *)susan_wccmalloc(x_size*y_size); + cgy=(char *)susan_wccmalloc(x_size*y_size); + + _Pragma( "loopbound min 85 max 85" ) + for (i=5;i ((n*n)/2) ) { + if(yy290){ + r[i*x_size+j] = max_no-n; + cgx[i*x_size+j] = (51*x)/n; + cgy[i*x_size+j] = (51*y)/n; + } + } + } + }}}}}}}}}}}}}}}}}} + } + } + + /* to locate the local maxima */ + n=0; + _Pragma( "loopbound min 85 max 85" ) + for (i=5;i0) { + /* 5x5 mask */ + #ifdef FIVE_SUPP + if ((x>r[(i-1)*x_size+j+2]) && + (x>r[(i )*x_size+j+1]) && + (x>r[(i )*x_size+j+2]) && + (x>r[(i+1)*x_size+j-1]) && + (x>r[(i+1)*x_size+j ]) && + (x>r[(i+1)*x_size+j+1]) && + (x>r[(i+1)*x_size+j+2]) && + (x>r[(i+2)*x_size+j-2]) && + (x>r[(i+2)*x_size+j-1]) && + (x>r[(i+2)*x_size+j ]) && + (x>r[(i+2)*x_size+j+1]) && + (x>r[(i+2)*x_size+j+2]) && + (x>=r[(i-2)*x_size+j-2]) && + (x>=r[(i-2)*x_size+j-1]) && + (x>=r[(i-2)*x_size+j ]) && + (x>=r[(i-2)*x_size+j+1]) && + (x>=r[(i-2)*x_size+j+2]) && + (x>=r[(i-1)*x_size+j-2]) && + (x>=r[(i-1)*x_size+j-1]) && + (x>=r[(i-1)*x_size+j ]) && + (x>=r[(i-1)*x_size+j+1]) && + (x>=r[(i )*x_size+j-2]) && + (x>=r[(i )*x_size+j-1]) && + (x>=r[(i+1)*x_size+j-2]) ) + #endif + #ifdef SEVEN_SUPP + if ((x>r[(i-3)*x_size+j-3]) && + (x>r[(i-3)*x_size+j-2]) && + (x>r[(i-3)*x_size+j-1]) && + (x>r[(i-3)*x_size+j ]) && + (x>r[(i-3)*x_size+j+1]) && + (x>r[(i-3)*x_size+j+2]) && + (x>r[(i-3)*x_size+j+3]) && + + (x>r[(i-2)*x_size+j-3]) && + (x>r[(i-2)*x_size+j-2]) && + (x>r[(i-2)*x_size+j-1]) && + (x>r[(i-2)*x_size+j ]) && + (x>r[(i-2)*x_size+j+1]) && + (x>r[(i-2)*x_size+j+2]) && + (x>r[(i-2)*x_size+j+3]) && + + (x>r[(i-1)*x_size+j-3]) && + (x>r[(i-1)*x_size+j-2]) && + (x>r[(i-1)*x_size+j-1]) && + (x>r[(i-1)*x_size+j ]) && + (x>r[(i-1)*x_size+j+1]) && + (x>r[(i-1)*x_size+j+2]) && + (x>r[(i-1)*x_size+j+3]) && + + (x>r[(i)*x_size+j-3]) && + (x>r[(i)*x_size+j-2]) && + (x>r[(i)*x_size+j-1]) && + (x>=r[(i)*x_size+j+1]) && + (x>=r[(i)*x_size+j+2]) && + (x>=r[(i)*x_size+j+3]) && + + (x>=r[(i+1)*x_size+j-3]) && + (x>=r[(i+1)*x_size+j-2]) && + (x>=r[(i+1)*x_size+j-1]) && + (x>=r[(i+1)*x_size+j ]) && + (x>=r[(i+1)*x_size+j+1]) && + (x>=r[(i+1)*x_size+j+2]) && + (x>=r[(i+1)*x_size+j+3]) && + + (x>=r[(i+2)*x_size+j-3]) && + (x>=r[(i+2)*x_size+j-2]) && + (x>=r[(i+2)*x_size+j-1]) && + (x>=r[(i+2)*x_size+j ]) && + (x>=r[(i+2)*x_size+j+1]) && + (x>=r[(i+2)*x_size+j+2]) && + (x>=r[(i+2)*x_size+j+3]) && + + (x>=r[(i+3)*x_size+j-3]) && + (x>=r[(i+3)*x_size+j-2]) && + (x>=r[(i+3)*x_size+j-1]) && + (x>=r[(i+3)*x_size+j ]) && + (x>=r[(i+3)*x_size+j+1]) && + (x>=r[(i+3)*x_size+j+2]) && + (x>=r[(i+3)*x_size+j+3]) ) + #endif + { + corner_list[n].info=0; + corner_list[n].x=j; + corner_list[n].y=i; + corner_list[n].dx=cgx[i*x_size+j]; + corner_list[n].dy=cgy[i*x_size+j]; + corner_list[n].I=in[i*x_size+j]; + n++; + if(n==MAX_CORNERS){ + /* "Too many corners." */ + } + } + } + } + } + corner_list[n].info=7; +} + + +void susan_corners_quick( uchar *in, char *r, uchar *bp, + int max_no, CORNER_LIST corner_list, int x_size, int y_size ) +{ + int n,x,y,i,j; + uchar *p,*cp; + + susan_wccmemset(r,0,x_size * y_size); + + _Pragma( "loopbound min 0 max 0" ) + for (i=7;i0) { + /* 5x5 mask */ + #ifdef FIVE_SUPP + if ((x>r[(i-1)*x_size+j+2]) && + (x>r[(i )*x_size+j+1]) && + (x>r[(i )*x_size+j+2]) && + (x>r[(i+1)*x_size+j-1]) && + (x>r[(i+1)*x_size+j ]) && + (x>r[(i+1)*x_size+j+1]) && + (x>r[(i+1)*x_size+j+2]) && + (x>r[(i+2)*x_size+j-2]) && + (x>r[(i+2)*x_size+j-1]) && + (x>r[(i+2)*x_size+j ]) && + (x>r[(i+2)*x_size+j+1]) && + (x>r[(i+2)*x_size+j+2]) && + (x>=r[(i-2)*x_size+j-2]) && + (x>=r[(i-2)*x_size+j-1]) && + (x>=r[(i-2)*x_size+j ]) && + (x>=r[(i-2)*x_size+j+1]) && + (x>=r[(i-2)*x_size+j+2]) && + (x>=r[(i-1)*x_size+j-2]) && + (x>=r[(i-1)*x_size+j-1]) && + (x>=r[(i-1)*x_size+j ]) && + (x>=r[(i-1)*x_size+j+1]) && + (x>=r[(i )*x_size+j-2]) && + (x>=r[(i )*x_size+j-1]) && + (x>=r[(i+1)*x_size+j-2]) ) + #endif + #ifdef SEVEN_SUPP + if ((x>r[(i-3)*x_size+j-3]) && + (x>r[(i-3)*x_size+j-2]) && + (x>r[(i-3)*x_size+j-1]) && + (x>r[(i-3)*x_size+j ]) && + (x>r[(i-3)*x_size+j+1]) && + (x>r[(i-3)*x_size+j+2]) && + (x>r[(i-3)*x_size+j+3]) && + + (x>r[(i-2)*x_size+j-3]) && + (x>r[(i-2)*x_size+j-2]) && + (x>r[(i-2)*x_size+j-1]) && + (x>r[(i-2)*x_size+j ]) && + (x>r[(i-2)*x_size+j+1]) && + (x>r[(i-2)*x_size+j+2]) && + (x>r[(i-2)*x_size+j+3]) && + + (x>r[(i-1)*x_size+j-3]) && + (x>r[(i-1)*x_size+j-2]) && + (x>r[(i-1)*x_size+j-1]) && + (x>r[(i-1)*x_size+j ]) && + (x>r[(i-1)*x_size+j+1]) && + (x>r[(i-1)*x_size+j+2]) && + (x>r[(i-1)*x_size+j+3]) && + + (x>r[(i)*x_size+j-3]) && + (x>r[(i)*x_size+j-2]) && + (x>r[(i)*x_size+j-1]) && + (x>=r[(i)*x_size+j+1]) && + (x>=r[(i)*x_size+j+2]) && + (x>=r[(i)*x_size+j+3]) && + + (x>=r[(i+1)*x_size+j-3]) && + (x>=r[(i+1)*x_size+j-2]) && + (x>=r[(i+1)*x_size+j-1]) && + (x>=r[(i+1)*x_size+j ]) && + (x>=r[(i+1)*x_size+j+1]) && + (x>=r[(i+1)*x_size+j+2]) && + (x>=r[(i+1)*x_size+j+3]) && + + (x>=r[(i+2)*x_size+j-3]) && + (x>=r[(i+2)*x_size+j-2]) && + (x>=r[(i+2)*x_size+j-1]) && + (x>=r[(i+2)*x_size+j ]) && + (x>=r[(i+2)*x_size+j+1]) && + (x>=r[(i+2)*x_size+j+2]) && + (x>=r[(i+2)*x_size+j+3]) && + + (x>=r[(i+3)*x_size+j-3]) && + (x>=r[(i+3)*x_size+j-2]) && + (x>=r[(i+3)*x_size+j-1]) && + (x>=r[(i+3)*x_size+j ]) && + (x>=r[(i+3)*x_size+j+1]) && + (x>=r[(i+3)*x_size+j+2]) && + (x>=r[(i+3)*x_size+j+3]) ) + #endif + { + corner_list[n].info=0; + corner_list[n].x=j; + corner_list[n].y=i; + x = in[(i-2)*x_size+j-2] + in[(i-2)*x_size+j-1] + in[(i-2)*x_size+j] + in[(i-2)*x_size+j+1] + in[(i-2)*x_size+j+2] + + in[(i-1)*x_size+j-2] + in[(i-1)*x_size+j-1] + in[(i-1)*x_size+j] + in[(i-1)*x_size+j+1] + in[(i-1)*x_size+j+2] + + in[(i )*x_size+j-2] + in[(i )*x_size+j-1] + in[(i )*x_size+j] + in[(i )*x_size+j+1] + in[(i )*x_size+j+2] + + in[(i+1)*x_size+j-2] + in[(i+1)*x_size+j-1] + in[(i+1)*x_size+j] + in[(i+1)*x_size+j+1] + in[(i+1)*x_size+j+2] + + in[(i+2)*x_size+j-2] + in[(i+2)*x_size+j-1] + in[(i+2)*x_size+j] + in[(i+2)*x_size+j+1] + in[(i+2)*x_size+j+2]; + + corner_list[n].I=x/25; + /*corner_list[n].I=in[i*x_size+j];*/ + x = in[(i-2)*x_size+j+2] + in[(i-1)*x_size+j+2] + in[(i)*x_size+j+2] + in[(i+1)*x_size+j+2] + in[(i+2)*x_size+j+2] - + (in[(i-2)*x_size+j-2] + in[(i-1)*x_size+j-2] + in[(i)*x_size+j-2] + in[(i+1)*x_size+j-2] + in[(i+2)*x_size+j-2]); + x += x + in[(i-2)*x_size+j+1] + in[(i-1)*x_size+j+1] + in[(i)*x_size+j+1] + in[(i+1)*x_size+j+1] + in[(i+2)*x_size+j+1] - + (in[(i-2)*x_size+j-1] + in[(i-1)*x_size+j-1] + in[(i)*x_size+j-1] + in[(i+1)*x_size+j-1] + in[(i+2)*x_size+j-1]); + + y = in[(i+2)*x_size+j-2] + in[(i+2)*x_size+j-1] + in[(i+2)*x_size+j] + in[(i+2)*x_size+j+1] + in[(i+2)*x_size+j+2] - + (in[(i-2)*x_size+j-2] + in[(i-2)*x_size+j-1] + in[(i-2)*x_size+j] + in[(i-2)*x_size+j+1] + in[(i-2)*x_size+j+2]); + y += y + in[(i+1)*x_size+j-2] + in[(i+1)*x_size+j-1] + in[(i+1)*x_size+j] + in[(i+1)*x_size+j+1] + in[(i+1)*x_size+j+2] - + (in[(i-1)*x_size+j-2] + in[(i-1)*x_size+j-1] + in[(i-1)*x_size+j] + in[(i-1)*x_size+j+1] + in[(i-1)*x_size+j+2]); + corner_list[n].dx=x/15; + corner_list[n].dy=y/15; + n++; + if(n==MAX_CORNERS){ + /* "Too many corners." */ + } + } + } + } + } + corner_list[n].info=7; +} + + +void susan_call_susan( struct wccFILE *inputFile, int mode ) +{ + uchar *in, *bp, *mid; + int x_size, y_size; + char *r; + CORNER_LIST corner_list; + + susan_get_image( inputFile, &in, &x_size, &y_size ); + + if (susan_dt<0) susan_three_by_three=1; + if ( (susan_principle_conf==1) && (mode==0) ) + mode=1; + + switch (mode) { + case 0: + /* {{{ smoothing */ + + susan_setup_brightness_lut(&bp,susan_bt,2); + susan_smoothing(susan_three_by_three,in,susan_dt,x_size,y_size,bp); + + break; + case 1: + /* {{{ edges */ + + r = (char *) susan_wccmalloc(x_size * y_size); + susan_setup_brightness_lut(&bp,susan_bt,6); + + if (susan_principle_conf) { + if (susan_three_by_three) + susan_principle_small(in,r,bp,susan_max_no_edges,x_size,y_size); + else + susan_principle(in,r,bp,susan_max_no_edges,x_size,y_size); + susan_int_to_uchar(r,in,x_size*y_size); + } else { + mid = (uchar *)susan_wccmalloc(x_size*y_size); + susan_wccmemset(mid,100,x_size * y_size); /* note not set to zero */ + + if (susan_three_by_three) + susan_edges_small(in,r,mid,bp,susan_max_no_edges,x_size,y_size); + else + susan_edges(in,r,mid,bp,susan_max_no_edges,x_size,y_size); + if(susan_thin_post_proc) + susan_thin(r,mid,x_size,y_size); + susan_edge_draw(in,mid,x_size,y_size,susan_drawing_mode); + } + + break; + case 2: + /* {{{ corners */ + + r = (char *) susan_wccmalloc(x_size * y_size); + susan_setup_brightness_lut(&bp,susan_bt,6); + + if (susan_principle_conf) { + susan_principle(in,r,bp,susan_max_no_corners,x_size,y_size); + susan_int_to_uchar(r,in,x_size*y_size); + } else { + if(susan_susan_quick) + susan_corners_quick(in,r,bp,susan_max_no_corners,corner_list,x_size,y_size); + else + susan_corners(in,r,bp,susan_max_no_corners,corner_list,x_size,y_size); + susan_corner_draw(in,corner_list,x_size,susan_drawing_mode); + } + + break; + } + + susan_put_image(x_size,y_size); +} + +void susan_init( void ) +{ + volatile int a = 0; + susan_file.data = susan_input; + susan_file.size = 7292; + susan_file.size += a; + susan_file.cur_pos = 0; + susan_file.cur_pos += a; + + susan_dt = 4.0; + susan_dt += a; + susan_bt = 20; + susan_bt += a; + susan_principle_conf = 0; + susan_principle_conf += a; + susan_thin_post_proc = 1; + susan_thin_post_proc += a; + susan_three_by_three = 0; + susan_three_by_three += a; + susan_drawing_mode = 0; + susan_drawing_mode += a; + susan_susan_quick = 0; + susan_susan_quick += a; + susan_max_no_corners = 50; + susan_max_no_corners += a; + susan_max_no_edges = 50; + susan_max_no_edges += a; + + // mode=0; /* Smoothing mode */ + // mode=1; /* Edges mode */ + // mode=2; /* Corners mode */ + + // principle=1; /* Output initial enhancement image only; corners or edges mode (default is edges mode) */ + // thin_post_proc=0; /* No post-processing on the binary edge map (runs much faster); edges mode */ + // drawing_mode=1; /* Mark corners/edges with single black points instead of black with white border; corners or edges mode */ + // three_by_three=1; /* Use flat 3x3 mask, edges or smoothing mode */ + // susan_quick=1; /* Use faster (and usually stabler) corner mode; edge-like corner suppression not carried out; corners mode */ + // dt=10.0; /* Distance threshold, smoothing mode, (default=4) */ + // bt=50; /* Brightness threshold, all modes, (default=20) */ +} + +void susan_main( void ) +{ + susan_call_susan( &susan_file, 0 ); + susan_wccfreeall(); + susan_call_susan( &susan_file, 1 ); + susan_wccfreeall(); + susan_call_susan( &susan_file, 2 ); + susan_wccfreeall(); +} + +int susan_return( void ) +{ + return 0; +} + +int main( int argc, char **argv ) +{ + SET_UP + for (jobsComplete=-1; jobsCompletecur_pos, i2 = 0; + size_x number_of_chars_to_read = + stream->size - stream->cur_pos >= size * count ? + size * count : stream->size - stream->cur_pos; + _Pragma( "loopbound min 7220 max 7220" ) + while (i < stream->cur_pos + number_of_chars_to_read) { + ((unsigned char*)ptr)[i2++] = stream->data[i++]; + } + stream->cur_pos += number_of_chars_to_read; + return number_of_chars_to_read; +} + +int susan_wccfgetc(struct wccFILE *stream) +{ + if ( susan_wccfeof( stream ) ) { + return EOFX; + } else { + return stream->data[stream->cur_pos++]; + } +} + +char *susan_wccfgets(char *str, int num, struct wccFILE *stream ) +{ + if ( !stream || susan_wccfeof( stream ) || !str || num <= 0 ) { + return 0; + } + + int pos = 0; + _Pragma( "loopbound min 58 max 58" ) + while ( pos < num - 1 && !susan_wccfeof( stream ) ) { + str[pos] = stream->data[stream->cur_pos]; + if ( str[pos] == '\n' ) { + break; + } + + stream->cur_pos++; + pos++; + } + str[pos++] = '\0'; + + return str; +} + +int susan_wccfseek(struct wccFILE* stream, long int offset, enum _Origin_ origin) +{ + if (origin == WCCSEEK_SET) { + stream->cur_pos = offset; + return 0; + } else if (origin == WCCSEEK_CUR) { + stream->cur_pos += offset; + return 0; + } else if (origin == WCCSEEK_END) { + stream->cur_pos = stream->size + offset; + return 0; + } + return -1; +} + + +int susan_wccfgetpos(struct wccFILE* stream, unsigned* position) +{ + *position = stream->cur_pos; + return 0; +} + + +int susan_wccfeof(struct wccFILE* stream) +{ + return stream->cur_pos == stream->size ? 1 : 0; +} diff --git a/all_pairs/source/susan/wccfile.h b/all_pairs/source/susan/wccfile.h new file mode 100644 index 0000000..9314361 --- /dev/null +++ b/all_pairs/source/susan/wccfile.h @@ -0,0 +1,24 @@ +#ifndef WCC_FILE_H +#define WCC_FILE_H + +enum _Origin_ { WCCSEEK_SET, WCCSEEK_CUR, WCCSEEK_END }; +typedef enum _Origin_ Origin; +typedef unsigned int size_x; + +#define EOFX -1 + +struct wccFILE { + char* data; + size_x size; + unsigned cur_pos; +}; + +size_x susan_wccfread (void* ptr, size_x size, size_x count, struct wccFILE* stream); +int susan_wccfseek (struct wccFILE* stream, long int offset, Origin origin); +int susan_wccfgetpos (struct wccFILE* stream, unsigned* position); +int susan_wccfeof (struct wccFILE* stream); +int susan_wccfgetc (struct wccFILE *stream); +char *susan_wccfgets (char *str, int num, struct wccFILE *stream ); + +#endif + diff --git a/all_pairs/source/susan/wcclibm.c b/all_pairs/source/susan/wcclibm.c new file mode 100644 index 0000000..bca8907 --- /dev/null +++ b/all_pairs/source/susan/wcclibm.c @@ -0,0 +1,444 @@ +#include "math_private.h" +#include "wcclibm.h" + + + +/* e_rem_pio2f.c -- float version of e_rem_pio2.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: e_rem_pio2f.c,v 1.5 1995/05/10 20:46:03 jtc Exp $"; +#endif + +/* __ieee754_rem_pio2f(x,y) + * + * return the remainder of x rem pi/2 in y[0]+y[1] + * use __kernel_rem_pio2f() + */ + +/* This array is like the one in e_rem_pio2.c, but the numbers are + single precision and the last 8 bits are forced to 0. */ +static const int32_t susan_npio2_hw[] = { +0x3fc90f00, 0x40490f00, 0x4096cb00, 0x40c90f00, 0x40fb5300, 0x4116cb00, +0x412fed00, 0x41490f00, 0x41623100, 0x417b5300, 0x418a3a00, 0x4196cb00, +0x41a35c00, 0x41afed00, 0x41bc7e00, 0x41c90f00, 0x41d5a000, 0x41e23100, +0x41eec200, 0x41fb5300, 0x4203f200, 0x420a3a00, 0x42108300, 0x4216cb00, +0x421d1400, 0x42235c00, 0x4229a500, 0x422fed00, 0x42363600, 0x423c7e00, +0x4242c700, 0x42490f00 +}; + +/* + * invpio2: 24 bits of 2/pi + * pio2_1: first 17 bit of pi/2 + * pio2_1t: pi/2 - pio2_1 + * pio2_2: second 17 bit of pi/2 + * pio2_2t: pi/2 - (pio2_1+pio2_2) + * pio2_3: third 17 bit of pi/2 + * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) + */ + +static const float +/* zero = 0.0000000000e+00f, /\* 0x00000000 *\/ */ +/* half = 5.0000000000e-01f, /\* 0x3f000000 *\/ */ +/* two8 = 2.5600000000e+02f, /\* 0x43800000 *\/ */ +susan_invpio2 = 6.3661980629e-01f, /* 0x3f22f984 */ +susan_pio2_1 = 1.5707855225e+00f, /* 0x3fc90f80 */ +susan_pio2_1t = 1.0804334124e-05f, /* 0x37354443 */ +susan_pio2_2 = 1.0804273188e-05f, /* 0x37354400 */ +susan_pio2_2t = 6.0770999344e-11f, /* 0x2e85a308 */ +susan_pio2_3 = 6.0770943833e-11f, /* 0x2e85a300 */ +susan_pio2_3t = 6.1232342629e-17f; /* 0x248d3132 */ + +int32_t susan___ieee754_rem_pio2f(float x, float *y) +{ + float z,w,t,r,fn; + int32_t i,j,n,ix,hx; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix<=0x3f490fd8) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4016cbe4) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - susan_pio2_1; + if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ + y[0] = z - susan_pio2_1t; + y[1] = (z-y[0])-susan_pio2_1t; + } else { /* near pi/2, use 24+24+24 bit pi */ + z -= susan_pio2_2; + y[0] = z - susan_pio2_2t; + y[1] = (z-y[0])-susan_pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + susan_pio2_1; + if((ix&0xfffffff0)!=0x3fc90fd0) { /* 24+24 bit pi OK */ + y[0] = z + susan_pio2_1t; + y[1] = (z-y[0])+susan_pio2_1t; + } else { /* near pi/2, use 24+24+24 bit pi */ + z += susan_pio2_2; + y[0] = z + susan_pio2_2t; + y[1] = (z-y[0])+susan_pio2_2t; + } + return -1; + } + } + if(ix<=0x43490f80) { /* |x| ~<= 2^7*(pi/2), medium size */ + t = fabsf(x); + n = (int32_t) (t*susan_invpio2+susan_half); + fn = (float)n; + r = t-fn*susan_pio2_1; + w = fn*susan_pio2_1t; /* 1st round good to 40 bit */ + if(n<32&&(int32_t)(ix&0xffffff00)!=susan_npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + u_int32_t high; + j = ix>>23; + y[0] = r-w; + GET_FLOAT_WORD(high,y[0]); + i = j-((high>>23)&0xff); + if(i>8) { /* 2nd iteration needed, good to 57 */ + t = r; + w = fn*susan_pio2_2; + r = t-w; + w = fn*susan_pio2_2t-((t-r)-w); + y[0] = r-w; + GET_FLOAT_WORD(high,y[0]); + i = j-((high>>23)&0xff); + if(i>25) { /* 3rd iteration need, 74 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*susan_pio2_3; + r = t-w; + w = fn*susan_pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } + /* + * all other (large) arguments + */ + if(ix>=0x7f800000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } + + y[0]=y[1]=x-x; return 0; /* dummy initialisation */ + return 0; /* doesn't happen for our input */ +} + +/* k_cosf.c -- float version of k_cos.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_cosf.c,v 1.4 1995/05/10 20:46:23 jtc Exp $"; +#endif + + +static const float +/* one = 1.0000000000e+00, /\* 0x3f800000 *\/ */ +susan_C1 = 4.1666667908e-02f, /* 0x3d2aaaab */ +susan_C2 = -1.3888889225e-03f, /* 0xbab60b61 */ +susan_C3 = 2.4801587642e-05f, /* 0x37d00d01 */ +susan_C4 = -2.7557314297e-07f, /* 0xb493f27c */ +susan_C5 = 2.0875723372e-09f, /* 0x310f74f6 */ +susan_C6 = -1.1359647598e-11f; /* 0xad47d74e */ + +float susan___kernel_cosf(float x, float y) +{ + float a,hz,z,r,qx; + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; /* ix = |x|'s high word*/ + if(ix<0x32000000) { /* if x < 2**27 */ + if(((int)x)==0) return susan_one; /* generate inexact */ + } + z = x*x; + r = z*(susan_C1+z*(susan_C2+z*(susan_C3+z*(susan_C4+z*(susan_C5+z*susan_C6))))); + if(ix < 0x3e99999a) /* if |x| < 0.3 */ + return susan_one - ((float)0.5f*z - (z*r - x*y)); + else { + if(ix > 0x3f480000) { /* x > 0.78125 */ + qx = (float)0.28125f; + } else { + SET_FLOAT_WORD(qx,ix-0x01000000); /* x/4 */ + } + hz = (float)0.5f*z-qx; + a = susan_one-qx; + return a - (hz - (z*r-x*y)); + } +} + +/* k_sinf.c -- float version of k_sin.c + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: k_sinf.c,v 1.4 1995/05/10 20:46:33 jtc Exp $"; +#endif + + +static const float +/* half = 5.0000000000e-01f,/\* 0x3f000000 *\/ */ +susan_S1 = -1.6666667163e-01f, /* 0xbe2aaaab */ +susan_S2 = 8.3333337680e-03f, /* 0x3c088889 */ +susan_S3 = -1.9841270114e-04f, /* 0xb9500d01 */ +susan_S4 = 2.7557314297e-06f, /* 0x3638ef1b */ +susan_S5 = -2.5050759689e-08f, /* 0xb2d72f34 */ +susan_S6 = 1.5896910177e-10f; /* 0x2f2ec9d3 */ + +float susan___kernel_sinf(float x, float y, int iy) +{ + float z,r,v; + int32_t ix; + GET_FLOAT_WORD(ix,x); + ix &= 0x7fffffff; /* high word of x */ + if(ix<0x32000000) /* |x| < 2**-27 */ + {if((int)x==0) return x;} /* generate inexact */ + z = x*x; + v = z*x; + r = susan_S2+z*(susan_S3+z*(susan_S4+z*(susan_S5+z*susan_S6))); + if(iy==0) return x+v*(susan_S1+z*r); + else return x-((z*(susan_half*y-v*r)-y)-v*susan_S1); +} +/* s_atanf.c -- float version of s_atan.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(LIBM_SCCS) && !defined(lint) +static char rcsid[] = "$NetBSD: s_atanf.c,v 1.4 1995/05/10 20:46:47 jtc Exp $"; +#endif + + +static const float susan_atanhi[] = { + 4.6364760399e-01f, /* atan(0.5)hi 0x3eed6338 */ + 7.8539812565e-01f, /* atan(1.0)hi 0x3f490fda */ + 9.8279368877e-01f, /* atan(1.5)hi 0x3f7b985e */ + 1.5707962513e+00f, /* atan(inf)hi 0x3fc90fda */ +}; + +static const float susan_atanlo[] = { + 5.0121582440e-09f, /* atan(0.5)lo 0x31ac3769 */ + 3.7748947079e-08f, /* atan(1.0)lo 0x33222168 */ + 3.4473217170e-08f, /* atan(1.5)lo 0x33140fb4 */ + 7.5497894159e-08f, /* atan(inf)lo 0x33a22168 */ +}; + +static const float susan_aT[] = { + 3.3333334327e-01f, /* 0x3eaaaaaa */ + -2.0000000298e-01f, /* 0xbe4ccccd */ + 1.4285714924e-01f, /* 0x3e124925 */ + -1.1111110449e-01f, /* 0xbde38e38 */ + 9.0908870101e-02f, /* 0x3dba2e6e */ + -7.6918758452e-02f, /* 0xbd9d8795 */ + 6.6610731184e-02f, /* 0x3d886b35 */ + -5.8335702866e-02f, /* 0xbd6ef16b */ + 4.9768779427e-02f, /* 0x3d4bda59 */ + -3.6531571299e-02f, /* 0xbd15a221 */ + 1.6285819933e-02f, /* 0x3c8569d7 */ +}; + +float susan___atanf(float x) +{ + float w,s1,s2,z; + int32_t ix,hx,id; + + GET_FLOAT_WORD(hx,x); + ix = hx&0x7fffffff; + if(ix>=0x50800000) { /* if |x| >= 2^34 */ + if(ix>0x7f800000) + return x+x; /* NaN */ + if(hx>0) return susan_atanhi[3]+susan_atanlo[3]; + else return -susan_atanhi[3]-susan_atanlo[3]; + } if (ix < 0x3ee00000) { /* |x| < 0.4375 */ + if (ix < 0x31000000) { /* |x| < 2^-29 */ + if(susan_huge+x>susan_one) return x; /* raise inexact */ + } + id = -1; + } else { + x = fabsf(x); + if (ix < 0x3f980000) { /* |x| < 1.1875 */ + if (ix < 0x3f300000) { /* 7/16 <=|x|<11/16 */ + id = 0; x = ((float)2.0f*x-susan_one)/((float)2.0f+x); + } else { /* 11/16<=|x|< 19/16 */ + id = 1; x = (x-susan_one)/(x+susan_one); + } + } else { + if (ix < 0x401c0000) { /* |x| < 2.4375 */ + id = 2; x = (x-(float)1.5f)/(susan_one+(float)1.5f*x); + } else { /* 2.4375 <= |x| < 2^66 */ + id = 3; x = -(float)1.0f/x; + } + }} + /* end of argument reduction */ + z = x*x; + w = z*z; + /* break sum from i=0 to 10 aT[i]z**(i+1) into odd and even poly */ + s1 = z*(susan_aT[0]+w*(susan_aT[2]+w*(susan_aT[4]+w*(susan_aT[6]+w*(susan_aT[8]+w*susan_aT[10]))))); + s2 = w*(susan_aT[1]+w*(susan_aT[3]+w*(susan_aT[5]+w*(susan_aT[7]+w*susan_aT[9])))); + if (id<0) return x - x*(s1+s2); + else { + z = susan_atanhi[id] - ((x*(s1+s2) - susan_atanlo[id]) - x); + return (hx<0)? -z:z; + } +} + +/* s_cosf.c -- float version of s_cos.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +float susan___cosf(float x) +{ + float y[2],z=0.0f; + int32_t n,ix; + + GET_FLOAT_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3f490fd8) return susan___kernel_cosf(x,z); + + /* cos(Inf or NaN) is NaN */ + else if (ix>=0x7f800000) return x-x; + + /* argument reduction needed */ + else { + n = susan___ieee754_rem_pio2f(x,y); + switch(n&3) { + case 0: return susan___kernel_cosf(y[0],y[1]); + case 1: return -susan___kernel_sinf(y[0],y[1],1); + case 2: return -susan___kernel_cosf(y[0],y[1]); + default: + return susan___kernel_sinf(y[0],y[1],1); + } + } +} + +/* s_sinf.c -- float version of s_sin.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +float susan___sinf(float x) +{ + float y[2],z=0.0; + int32_t n, ix; + + GET_FLOAT_WORD(ix,x); + + /* |x| ~< pi/4 */ + ix &= 0x7fffffff; + if(ix <= 0x3f490fd8) return susan___kernel_sinf(x,z,0); + + /* sin(Inf or NaN) is NaN */ + else if (ix>=0x7f800000) return x-x; + + /* argument reduction needed */ + else { + n = susan___ieee754_rem_pio2f(x,y); + switch(n&3) { + case 0: return susan___kernel_sinf(y[0],y[1],1); + case 1: return susan___kernel_cosf(y[0],y[1]); + case 2: return -susan___kernel_sinf(y[0],y[1],1); + default: + return -susan___kernel_cosf(y[0],y[1]); + } + } +} + +/* s_fabsf.c -- float version of s_fabs.c. + * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * fabsf(x) returns the absolute value of x. + */ + + +float susan___fabsf(float x) +{ + u_int32_t ix; + GET_FLOAT_WORD(ix,x); + SET_FLOAT_WORD(x,ix&0x7fffffff); + return x; +} diff --git a/all_pairs/source/susan/wcclibm.h b/all_pairs/source/susan/wcclibm.h new file mode 100644 index 0000000..bcf4c65 --- /dev/null +++ b/all_pairs/source/susan/wcclibm.h @@ -0,0 +1,53 @@ +#ifndef _WCCLIBM +#define _WCCLIBM + +#define int32_t int +#define uint32_t unsigned int +#define u_int16_t unsigned short +#define u_int32_t unsigned int + +// Often used variables/consts +#ifdef __STDC__ +static const float +#else +static float +#endif +susan_one = 1.0f, +susan_half = 5.0000000000e-01f, /* 0x3f000000 */ +susan_zero = 0.0f, +susan_huge = 1.0e30, +susan_two8 = 2.5600000000e+02f, /* 0x43800000 */ +susan_twon8 = 3.9062500000e-03f; /* 0x3b800000 */ + +// The following defines map the math functions to specialized calls +#define acos susan___ieee754_acosf +#define atan susan___atanf +#define cos susan___cosf +#define fabs susan___fabsf +#define fabsf susan___fabsf +#define isinf susan___isinff +#define pow susan___ieee754_powf +#define sqrt susan___ieee754_sqrtf +#define log10 susan___ieee754_log10f +#define log susan___ieee754_logf +#define sin susan___sinf + +float susan___atanf(float x); +float susan___copysignf(float x, float y); +float susan___cosf(float x); +float susan___fabsf(float x); +float susan___floorf(float x); +float susan___ieee754_acosf(float x); +float susan___ieee754_powf(float x, float y); +int32_t susan___ieee754_rem_pio2f(float x, float *y); +float susan___ieee754_sqrtf(float x); +int susan___isinff (float x); +float susan___kernel_cosf(float x, float y); +float susan___kernel_sinf(float x, float y, int iy); +int susan___kernel_rem_pio2f(float *x, float *y, int e0, int nx, int prec, const int32_t *ipio2); +float susan___scalbnf (float x, int n); +float susan___ieee754_logf(float x); +float susan___ieee754_log10f(float x); +float susan___sinf(float x); + +#endif // _WCCLIBM diff --git a/all_pairs/source/susan/wccmalloc.c b/all_pairs/source/susan/wccmalloc.c new file mode 100644 index 0000000..edf01cc --- /dev/null +++ b/all_pairs/source/susan/wccmalloc.c @@ -0,0 +1,51 @@ +#include "wccmalloc.h" + +// This must be redefined for each new benchmark +#define HEAP_SIZE 30000 + +char susan_simulated_heap[HEAP_SIZE]; +unsigned int susan_freeHeapPos; + +void* susan_wccmalloc( unsigned int numberOfBytes ) +{ + // Get a 4-byte adress for alignment purposes + unsigned int offset = ( (unsigned long)susan_simulated_heap + susan_freeHeapPos ) % 4; + if ( offset ) { + susan_freeHeapPos += 4 - offset; + } + void* currentPos = (void*)&susan_simulated_heap[susan_freeHeapPos]; + susan_freeHeapPos += numberOfBytes; + return currentPos; +} +void susan_wccfreeall( void ) +{ + susan_freeHeapPos = 0; +} + +void* susan_wccmemcpy(void* dstpp, const void* srcpp, unsigned int len) +{ + unsigned long int dstp = (long int) dstpp; + unsigned long int srcp = (long int) srcpp; + + _Pragma("loopbound min 76 max 76") + while (len > 0) { + char __x = ((char *) srcp)[0]; + srcp += 1; + len -= 1; + ((char *) dstp)[0] = __x; + dstp += 1; + } + + return dstpp; +} + +void susan_wccmemset( void *p, int value, unsigned int num ) +{ + unsigned long i; + char *char_ptr = (char*)p; + + _Pragma( "loopbound min 7220 max 28880" ) + for ( i = 0; i < num; ++i ) { + *char_ptr++ = (unsigned char)value; + } +} diff --git a/all_pairs/source/susan/wccmalloc.h b/all_pairs/source/susan/wccmalloc.h new file mode 100644 index 0000000..dbb2ada --- /dev/null +++ b/all_pairs/source/susan/wccmalloc.h @@ -0,0 +1,10 @@ +#ifndef _WCCMALLOC_H +#define _WCCMALLOC_H + +void* susan_wccmalloc( unsigned int numberOfBytes ); +//! Frees ALL allocated memory space +void susan_wccfreeall( void ); +void *susan_wccmemcpy( void* dstpp, const void* srcpp, unsigned int len ); +void susan_wccmemset( void *p, int value, unsigned int num ); + +#endif -- cgit v1.2.2