SA-C Source Code for Probing

What follows is the SA-C source code for the probing application. The code comes in two parts: the SA-C source code, and a #include file that defines the probes and probe sets. The SA-C code is given in its entirety below. Since there are over 19,000 probes in 324 probe sets, only a fraction of the include file is given.


Probe.sc:


			
export main;
// First return is max response & second is its index
uint8[:,:], uint8[:,:] main (uint12 A[:,:]) {


// Include probset_Num_OfNum.inc
#include "Probes.inc"
  uint11 thresh = 100;
  uint8 R0[:,:], uint8 R1[:,:] =
    // PRAGMA (nextify_cse, scrunch, part_unroll (2,1))
    for window W[sy,sx] in A {
      uint8 maxes[2] = for probeset(~,:,:) in set at (uint8 num_set, _, _) {

				
 uint8 RR0 = do_probe_set (probeset, W, thresh, sizes[num_set]);
 
      } return (vals_at_first_max(RR0, {RR0, num_set}));
    } return (array (maxes[0]), array(maxes[1]));
} return (R0, R1);
uint8 do_probe_set (uint12 set[:,4], uint12 W[:,:], uint11 thresh, uint8 set_size) {
  uint8 R = for uint8 i in [set_size]
   return (sum (prb (W, set[i,:], thresh)));
} return (R);
uint8 prb (uint12 W[:,:], uint12 C[4], uint11 thresh) {
  uint12 x0, uint12 y0, uint12 x1, uint12 y1 = C[0], C[1], C[2], C[3];
  uint12 x_mx = x0>x1?x0:x1;
  uint12 x_mn = x0>x1?x1:x0;
  uint12 y_mx = y0>y1?y0:y1;
  uint12 y_mn = y0>y1?y1:y0;
  uint12 S[:,:] = W[x_mn:x_mx,y_mn:y_mx];
  uint12 v0 = S[x0-x_mn,y0-y_mn];
  uint12 v1 = S[x1-x_mn,y1-y_mn];
  int13 d = (int13)v0 - v1;
  uint8 b = (((d>thresh)||(d< -thresh))?1:0);
} return (b);

			

Probes.inc (#include file):

// *------------------------------------
// |  Files:  LadarTemplates.100m
// |  Probes: 0-323
// |  Count:  324 / 324
// |  Window: 15 X 40
// *------------------------------------
//Dimensions:
uint12 sy = 15;
uint12 sx = 40;
//Number of valid probes in each probeset:
uint8 sizes[324] = {22,21,21,23,23,24,25,27,27,30,32,29,29,30,29,32,32,32,30,27,26,24,24,23,22,22,21,22,21,23,23,24,26,25,27,27,30,32,33,33,31,31,32,33,33,30,28,26,25,26,25,23,23,21,24,23,24,24,24,26,28,29,29,30,31,33,32,32,32,31,31,31,31,29,29,27,28,24,24,23,23,28,28,28,28,30,32,36,34,36,38,39,40,39,35,36,39,40,41,38,35,34,33,32,29,29,26,27,28,26,29,29,32,34,35,37,39,39,39,41,38,37,36,38,42,40,41,39,38,34,34,33,31,28,28,32,30,31,31,35,34,35,37,37,39,42,40,40,40,39,42,38,42,39,39,38,35,36,34,33,29,30,23,23,23,25,24,26,26,28,30,30,33,30,33,33,28,30,31,30,29,29,28,27,26,24,23,21,23,25,26,25,25,27,28,28,29,29,33,31,32,33,29,29,29,33,33,31,30,27,29,26,26,27,25,26,27,28,25,26,28,29,29,31,33,30,33,35,33,31,31,32,35,32,30,34,33,29,31,26,25,24,28,22,22,23,26,25,28,28,29,30,30,30,33,33,30,30,33,34,32,30,31,30,26,27,25,25,24,23,26,26,26,28,28,29,30,30,33,32,33,35,33,31,28,33,32,32,33,34,31,28,30,28,28,25,26,28,28,26,28,31,31,30,32,34,35,34,36,36,34,31,36,38,33,35,34,32,30,33,29,29,28,28};
// Actual Probesuite:
uint12 set[324,42,4] = {
 { // Probeset 0
  {3,15,6,16},
  {3,16,5,16},
  {3,17,5,17},
  {3,18,5,18},
  {3,19,5,19},

.... and so on