voronoiExtract.gpu.incl 666 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm

// These are templated functions
// Need to `#define DistFn` to a distance function

#define DIST_FN(fn) FUNCTION_NAME_2(fn, DistFn)

__device__ float DIST_FN(extractDist_NoWrap)(int32_t x, int32_t y,
                                             uint32_t v,
                                             PanoRegion region) {
  if (!(v & 0x80000000)) {
    return MAX_FLOAT_DISTANCE; // max dist
  } else {
    int32_t sy = (v & 0x3fffffff) / region.viewWidth;
    int32_t sx = (v & 0x3fffffff) - region.viewWidth * sy;
    return DIST_FN(compute)(x, y, sx, sy, region);
  }
}

#undef DIST_FN