pyfast 4.12.0__cp36-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (307) hide show
  1. fast/README.md +41 -0
  2. fast/__init__.py +22 -0
  3. fast/bin/DirectML.dll +0 -0
  4. fast/bin/FAST.dll +0 -0
  5. fast/bin/InferenceEngineONNXRuntime.dll +0 -0
  6. fast/bin/InferenceEngineOpenVINO.dll +0 -0
  7. fast/bin/InferenceEngineTensorFlow.dll +0 -0
  8. fast/bin/InferenceEngineTensorRT.dll +0 -0
  9. fast/bin/JKQTCommonSharedLib_Release.dll +0 -0
  10. fast/bin/JKQTFastPlotterSharedLib_Release.dll +0 -0
  11. fast/bin/JKQTMathTextSharedLib_Release.dll +0 -0
  12. fast/bin/JKQTPlotterSharedLib_Release.dll +0 -0
  13. fast/bin/OpenCL.dll +0 -0
  14. fast/bin/OpenIGTLink.dll +0 -0
  15. fast/bin/Qt5Concurrent.dll +0 -0
  16. fast/bin/Qt5Core.dll +0 -0
  17. fast/bin/Qt5DBus.dll +0 -0
  18. fast/bin/Qt5Gui.dll +0 -0
  19. fast/bin/Qt5Multimedia.dll +0 -0
  20. fast/bin/Qt5MultimediaWidgets.dll +0 -0
  21. fast/bin/Qt5Network.dll +0 -0
  22. fast/bin/Qt5OpenGL.dll +0 -0
  23. fast/bin/Qt5PrintSupport.dll +0 -0
  24. fast/bin/Qt5SerialPort.dll +0 -0
  25. fast/bin/Qt5Sql.dll +0 -0
  26. fast/bin/Qt5Svg.dll +0 -0
  27. fast/bin/Qt5Test.dll +0 -0
  28. fast/bin/Qt5Widgets.dll +0 -0
  29. fast/bin/Qt5Xml.dll +0 -0
  30. fast/bin/UFFviewer.exe +0 -0
  31. fast/bin/_fast.pyd +0 -0
  32. fast/bin/brotlicommon.dll +0 -0
  33. fast/bin/brotlidec.dll +0 -0
  34. fast/bin/brotlienc.dll +0 -0
  35. fast/bin/cache.json +114134 -0
  36. fast/bin/dcmdata.dll +0 -0
  37. fast/bin/dcmimage.dll +0 -0
  38. fast/bin/dcmimgle.dll +0 -0
  39. fast/bin/dcmjpeg.dll +0 -0
  40. fast/bin/fast_configuration.txt +14 -0
  41. fast/bin/gna.dll +0 -0
  42. fast/bin/ijg12.dll +0 -0
  43. fast/bin/ijg16.dll +0 -0
  44. fast/bin/ijg8.dll +0 -0
  45. fast/bin/jxl.dll +0 -0
  46. fast/bin/jxl_cms.dll +0 -0
  47. fast/bin/jxl_threads.dll +0 -0
  48. fast/bin/libcrypto-1_1-x64.dll +0 -0
  49. fast/bin/libjpeg.dll +0 -0
  50. fast/bin/libopenslide-1.dll +0 -0
  51. fast/bin/libssl-1_1-x64.dll +0 -0
  52. fast/bin/oflog.dll +0 -0
  53. fast/bin/ofstd.dll +0 -0
  54. fast/bin/onnxruntime.dll +0 -0
  55. fast/bin/onnxruntime_providers_shared.dll +0 -0
  56. fast/bin/openvino.dll +0 -0
  57. fast/bin/openvino_auto_batch_plugin.dll +0 -0
  58. fast/bin/openvino_auto_plugin.dll +0 -0
  59. fast/bin/openvino_c.dll +0 -0
  60. fast/bin/openvino_gapi_preproc.dll +0 -0
  61. fast/bin/openvino_hetero_plugin.dll +0 -0
  62. fast/bin/openvino_intel_cpu_plugin.dll +0 -0
  63. fast/bin/openvino_intel_gna_plugin.dll +0 -0
  64. fast/bin/openvino_intel_gpu_plugin.dll +0 -0
  65. fast/bin/openvino_ir_frontend.dll +0 -0
  66. fast/bin/openvino_onnx_frontend.dll +0 -0
  67. fast/bin/openvino_paddle_frontend.dll +0 -0
  68. fast/bin/plugins.xml +24 -0
  69. fast/bin/realsense2.dll +0 -0
  70. fast/bin/runPipeline.exe +0 -0
  71. fast/bin/systemCheck.exe +0 -0
  72. fast/bin/tbb.dll +0 -0
  73. fast/bin/tbb_preview.dll +0 -0
  74. fast/bin/tbbbind.dll +0 -0
  75. fast/bin/tbbmalloc.dll +0 -0
  76. fast/bin/tbbmalloc_proxy.dll +0 -0
  77. fast/bin/tiff.dll +0 -0
  78. fast/bin/zlib.dll +0 -0
  79. fast/doc/bright-plotting-style.ini +66 -0
  80. fast/doc/dark-plotting-style.ini +66 -0
  81. fast/doc/fonts/UFL.txt +96 -0
  82. fast/doc/fonts/Ubuntu-Bold.ttf +0 -0
  83. fast/doc/fonts/Ubuntu-BoldItalic.ttf +0 -0
  84. fast/doc/fonts/Ubuntu-Italic.ttf +0 -0
  85. fast/doc/fonts/Ubuntu-Light.ttf +0 -0
  86. fast/doc/fonts/Ubuntu-LightItalic.ttf +0 -0
  87. fast/doc/fonts/Ubuntu-Medium.ttf +0 -0
  88. fast/doc/fonts/Ubuntu-MediumItalic.ttf +0 -0
  89. fast/doc/fonts/Ubuntu-Regular.ttf +0 -0
  90. fast/doc/fonts/UbuntuMono-Bold.ttf +0 -0
  91. fast/doc/fonts/UbuntuMono-BoldItalic.ttf +0 -0
  92. fast/doc/fonts/UbuntuMono-Italic.ttf +0 -0
  93. fast/doc/fonts/UbuntuMono-Regular.ttf +0 -0
  94. fast/doc/images/FAST_logo_square.png +0 -0
  95. fast/doc/images/fast_icon.ico +0 -0
  96. fast/doc/images/fast_icon.png +0 -0
  97. fast/entry_points.py +14 -0
  98. fast/fast.py +20057 -0
  99. fast/kernels/Algorithms/AirwaySegmentation/AirwaySegmentation.cl +85 -0
  100. fast/kernels/Algorithms/ApplyColormap/ApplyColormap.cl +146 -0
  101. fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding2D.cl +61 -0
  102. fast/kernels/Algorithms/BinaryThresholding/BinaryThresholding3D.cl +61 -0
  103. fast/kernels/Algorithms/BlockMatching/BlockMatching.cl +257 -0
  104. fast/kernels/Algorithms/CenterlineExtraction/CenterlineExtraction.cl +153 -0
  105. fast/kernels/Algorithms/CoherentPointDrift/CoherentPointDrift.cl +0 -0
  106. fast/kernels/Algorithms/Color/ColorToGrayscale.cl +22 -0
  107. fast/kernels/Algorithms/Color/GrayscaleToColor.cl +19 -0
  108. fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing2D.cl +35 -0
  109. fast/kernels/Algorithms/GaussianSmoothing/GaussianSmoothing3D.cl +75 -0
  110. fast/kernels/Algorithms/GradientVectorFlow/EulerGradientVectorFlow.cl +174 -0
  111. fast/kernels/Algorithms/GradientVectorFlow/MultigridGradientVectorFlow.cl +407 -0
  112. fast/kernels/Algorithms/HounsefieldConverter/HounsefieldConverter.cl +22 -0
  113. fast/kernels/Algorithms/ImageAdd/ImageAdd.cl +79 -0
  114. fast/kernels/Algorithms/ImageCaster/ImageCaster.cl +38 -0
  115. fast/kernels/Algorithms/ImageChannelConverter/ImageChannelConverter.cl +121 -0
  116. fast/kernels/Algorithms/ImageFlipper/ImageFlipper2D.cl +23 -0
  117. fast/kernels/Algorithms/ImageFlipper/ImageFlipper3D.cl +51 -0
  118. fast/kernels/Algorithms/ImageGradient/ImageGradient.cl +71 -0
  119. fast/kernels/Algorithms/ImageInverter/ImageInverter.cl +30 -0
  120. fast/kernels/Algorithms/ImageMultiply/ImageMultiply.cl +79 -0
  121. fast/kernels/Algorithms/ImagePatch/PatchStitcher2D.cl +22 -0
  122. fast/kernels/Algorithms/ImagePatch/PatchStitcher3D.cl +95 -0
  123. fast/kernels/Algorithms/ImageResampler/ImageResampler2D.cl +40 -0
  124. fast/kernels/Algorithms/ImageResampler/ImageResampler3D.cl +32 -0
  125. fast/kernels/Algorithms/ImageResizer/ImageResizer.cl +134 -0
  126. fast/kernels/Algorithms/ImageSharpening/ImageSharpening.cl +47 -0
  127. fast/kernels/Algorithms/ImageSlicer/ImageSlicer.cl +77 -0
  128. fast/kernels/Algorithms/ImageTransposer/ImageTransposer2D.cl +16 -0
  129. fast/kernels/Algorithms/ImageTransposer/ImageTransposer3D.cl +45 -0
  130. fast/kernels/Algorithms/IntensityClipping/IntensityClipping2D.cl +19 -0
  131. fast/kernels/Algorithms/IntensityClipping/IntensityClipping3D.cl +20 -0
  132. fast/kernels/Algorithms/IntensityNormalization/IntensityNormalization.cl +85 -0
  133. fast/kernels/Algorithms/IntensityNormalization/ZeroMeanUnitVariance.cl +76 -0
  134. fast/kernels/Algorithms/KalmanFilterModelSegmentation/AppearanceModels/RidgeEdge/RidgeEdgeModel.cl +81 -0
  135. fast/kernels/Algorithms/LabelModifier/LabelModifier.cl +20 -0
  136. fast/kernels/Algorithms/LaplacianOfGaussian/LaplacianOfGaussian2D.cl +27 -0
  137. fast/kernels/Algorithms/LevelSet/LevelSetSegmentation.cl +132 -0
  138. fast/kernels/Algorithms/LungSegmentation/LungSegmentation.cl +22 -0
  139. fast/kernels/Algorithms/MeshToSegmentation/MeshToSegmentation.cl +184 -0
  140. fast/kernels/Algorithms/Morphology/Dilation.cl +56 -0
  141. fast/kernels/Algorithms/Morphology/Erosion.cl +64 -0
  142. fast/kernels/Algorithms/NeuralNetwork/NeuralNetwork.cl +122 -0
  143. fast/kernels/Algorithms/NeuralNetwork/VertexTensorToSegmentation.cl +13 -0
  144. fast/kernels/Algorithms/NonLocalMeans/NonLocalMeans2D.cl +94 -0
  145. fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing2D.cl +57 -0
  146. fast/kernels/Algorithms/SeededRegionGrowing/SeededRegionGrowing3D.cl +58 -0
  147. fast/kernels/Algorithms/Skeletonization/Skeletonization2D.cl +77 -0
  148. fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction.cl +519 -0
  149. fast/kernels/Algorithms/SurfaceExtraction/SurfaceExtraction_no_3d_write.cl +739 -0
  150. fast/kernels/Algorithms/TemporalSmoothing/ImageMovingAverage.cl +66 -0
  151. fast/kernels/Algorithms/TemporalSmoothing/ImageWeightedMovingAverage.cl +74 -0
  152. fast/kernels/Algorithms/TissueSegmentation/TissueSegmentation.cl +18 -0
  153. fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/InverseGradientSegmentation.cl +203 -0
  154. fast/kernels/Algorithms/TubeSegmentationAndCenterlineExtraction/TubeSegmentationAndCenterlineExtraction.cl +566 -0
  155. fast/kernels/Algorithms/Ultrasound/EnvelopeAndLogCompressor.cl +45 -0
  156. fast/kernels/Algorithms/Ultrasound/ScanConverter.cl +76 -0
  157. fast/kernels/Algorithms/UltrasoundImageCropper/UltrasoundImageCropper.cl +31 -0
  158. fast/kernels/Algorithms/UltrasoundImageEnhancement/UltrasoundImageEnhancement.cl +27 -0
  159. fast/kernels/Algorithms/VectorMedianFilter/VectorMedianFilter.cl +31 -0
  160. fast/kernels/ImageFill.cl +30 -0
  161. fast/kernels/ImageMinMax.cl +196 -0
  162. fast/kernels/ImageSum.cl +170 -0
  163. fast/kernels/Tests/Algorithms/DoubleFilter.cl +7 -0
  164. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.frag +8 -0
  165. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.geom +69 -0
  166. fast/kernels/Visualization/BoundingBoxRenderer/BoundingBoxRenderer.vert +17 -0
  167. fast/kernels/Visualization/HeatmapRenderer/HeatmapRenderer.cl +51 -0
  168. fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.frag +11 -0
  169. fast/kernels/Visualization/ImagePyramidRenderer/ImagePyramidRenderer.vert +15 -0
  170. fast/kernels/Visualization/ImageRenderer/ImageRenderer.vert +15 -0
  171. fast/kernels/Visualization/ImageRenderer/ImageRendererFLOAT.frag +18 -0
  172. fast/kernels/Visualization/ImageRenderer/ImageRendererINT.frag +18 -0
  173. fast/kernels/Visualization/ImageRenderer/ImageRendererUINT.frag +18 -0
  174. fast/kernels/Visualization/LineRenderer/LineRenderer.frag +8 -0
  175. fast/kernels/Visualization/LineRenderer/LineRenderer.geom +35 -0
  176. fast/kernels/Visualization/LineRenderer/LineRenderer.vert +20 -0
  177. fast/kernels/Visualization/LineRenderer/LineRenderer3D.frag +8 -0
  178. fast/kernels/Visualization/LineRenderer/LineRenderer3D.vert +20 -0
  179. fast/kernels/Visualization/LineRenderer/LineRendererJoints.frag +15 -0
  180. fast/kernels/Visualization/LineRenderer/LineRendererJoints.vert +24 -0
  181. fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.frag +11 -0
  182. fast/kernels/Visualization/SegmentationLabelRenderer/SegmentationLabelRenderer.vert +16 -0
  183. fast/kernels/Visualization/SegmentationRenderer/SegmentationPyramidRenderer.frag +53 -0
  184. fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.frag +52 -0
  185. fast/kernels/Visualization/SegmentationRenderer/SegmentationRenderer.vert +15 -0
  186. fast/kernels/Visualization/TextRenderer/TextRenderer.frag +11 -0
  187. fast/kernels/Visualization/TextRenderer/TextRenderer.vert +20 -0
  188. fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.frag +49 -0
  189. fast/kernels/Visualization/TriangleRenderer/TriangleRenderer.vert +35 -0
  190. fast/kernels/Visualization/VectorFieldRenderer/VectorFieldColorRenderer.cl +30 -0
  191. fast/kernels/Visualization/VertexRenderer/VertexRenderer.frag +14 -0
  192. fast/kernels/Visualization/VertexRenderer/VertexRenderer.vert +23 -0
  193. fast/kernels/Visualization/View.cl +10 -0
  194. fast/kernels/Visualization/VolumeRenderer/AlphaBlendingVolumeRenderer.cl +211 -0
  195. fast/kernels/Visualization/VolumeRenderer/MaximumIntensityProjection.cl +139 -0
  196. fast/kernels/Visualization/VolumeRenderer/ThresholdVolumeRenderer.cl +178 -0
  197. fast/licenses/LICENSE +203 -0
  198. fast/licenses/MSVC/MSVC_redis_files_license.txt +96 -0
  199. fast/licenses/OpenIGTLink/LICENSE.txt +30 -0
  200. fast/licenses/OpenJPEG/LICENSE +39 -0
  201. fast/licenses/OpenSlide/COPYING.LESSER +504 -0
  202. fast/licenses/PCRE2/LICENCE.md +103 -0
  203. fast/licenses/SQLite/PUBLIC-DOMAIN.txt +9 -0
  204. fast/licenses/THIRD_PARTY_TF_C_LICENSES +7955 -0
  205. fast/licenses/cairo/COPYING +33 -0
  206. fast/licenses/cairo/COPYING-LGPL-2.1 +510 -0
  207. fast/licenses/cairo/COPYING-MPL-1.1 +470 -0
  208. fast/licenses/clarius/LICENSE +29 -0
  209. fast/licenses/dcmtk/COPYRIGHT +1034 -0
  210. fast/licenses/directml/LICENSE-CODE.txt +21 -0
  211. fast/licenses/directml/LICENSE.txt +48 -0
  212. fast/licenses/directml/ThirdPartyNotices.txt +103 -0
  213. fast/licenses/eigen/COPYING.APACHE +203 -0
  214. fast/licenses/eigen/COPYING.BSD +26 -0
  215. fast/licenses/eigen/COPYING.GPL +674 -0
  216. fast/licenses/eigen/COPYING.LGPL +502 -0
  217. fast/licenses/eigen/COPYING.MINPACK +51 -0
  218. fast/licenses/eigen/COPYING.MPL2 +373 -0
  219. fast/licenses/eigen/COPYING.README +18 -0
  220. fast/licenses/fast/LICENSE +25 -0
  221. fast/licenses/gdk-pixbuf/COPYING +502 -0
  222. fast/licenses/glib/COPYING +175 -0
  223. fast/licenses/hdf5/COPYING +106 -0
  224. fast/licenses/jkqtplotter/LICENSE +505 -0
  225. fast/licenses/jpegxl/LICENSE.brotli +19 -0
  226. fast/licenses/jpegxl/LICENSE.highway +201 -0
  227. fast/licenses/jpegxl/LICENSE.jpeg-xl +27 -0
  228. fast/licenses/jpegxl/LICENSE.skcms +29 -0
  229. fast/licenses/jpegxl/PATENTS +22 -0
  230. fast/licenses/libdicom/LICENSE +21 -0
  231. fast/licenses/libffi/LICENSE +21 -0
  232. fast/licenses/libjpeg-turbo/LICENSE.md +135 -0
  233. fast/licenses/libjpeg-turbo/README.ijg +260 -0
  234. fast/licenses/libpng/LICENSE +134 -0
  235. fast/licenses/libtiff/LICENSE.md +23 -0
  236. fast/licenses/libxml2/Copyright +24 -0
  237. fast/licenses/onnxruntime/LICENSE +21 -0
  238. fast/licenses/onnxruntime/Privacy.md +21 -0
  239. fast/licenses/onnxruntime/ThirdPartyNotices.txt +6156 -0
  240. fast/licenses/opencl/LICENSE +201 -0
  241. fast/licenses/openssl/LICENSE.txt +125 -0
  242. fast/licenses/openvino/Apache_license.txt +201 -0
  243. fast/licenses/openvino/EULA.htm +43 -0
  244. fast/licenses/openvino/EULA.rtf +61 -0
  245. fast/licenses/openvino/EULA.txt +163 -0
  246. fast/licenses/openvino/GNA SOFTWARE LICENSE AGREEMENT.txt +1 -0
  247. fast/licenses/openvino/Intel_Software_Development_Products.rtf +1217 -0
  248. fast/licenses/openvino/Intel_Software_Development_Products.txt +707 -0
  249. fast/licenses/openvino/LICENSE +201 -0
  250. fast/licenses/openvino/OpenVINOsupport.txt +12 -0
  251. fast/licenses/openvino/onednn_third-party-programs.txt +557 -0
  252. fast/licenses/openvino/readme.txt +60 -0
  253. fast/licenses/openvino/redist.txt +42 -0
  254. fast/licenses/openvino/runtime-third-party-programs.txt +1400 -0
  255. fast/licenses/openvino/tbb_third-party-programs.txt +230 -0
  256. fast/licenses/pixman/COPYING +42 -0
  257. fast/licenses/proxy-libintl/COPYING +482 -0
  258. fast/licenses/qt5/LICENSE.FDL +450 -0
  259. fast/licenses/qt5/LICENSE.GPL3-EXCEPT +704 -0
  260. fast/licenses/qt5/LICENSE.GPLv2 +292 -0
  261. fast/licenses/qt5/LICENSE.GPLv3 +686 -0
  262. fast/licenses/qt5/LICENSE.LGPLv21 +514 -0
  263. fast/licenses/qt5/LICENSE.LGPLv3 +175 -0
  264. fast/licenses/qt5/LICENSE.QT-LICENSE-AGREEMENT +1331 -0
  265. fast/licenses/realsense/LICENSE +202 -0
  266. fast/licenses/realsense/NOTICE +937 -0
  267. fast/licenses/semaphore/Semaphore_LICENSE.txt +17 -0
  268. fast/licenses/tiff/COPYRIGHT +21 -0
  269. fast/licenses/uthash/LICENSE +21 -0
  270. fast/licenses/zip/UNLICENSE +26 -0
  271. fast/licenses/zlib/README +115 -0
  272. fast/licenses/zlib-ng/LICENSE.md +19 -0
  273. fast/pipelines/uff_viewer/colormap_and_reject.fpl +26 -0
  274. fast/pipelines/uff_viewer/default.fpl +9 -0
  275. fast/pipelines/uff_viewer/non_local_means.fpl +34 -0
  276. fast/plugins/audio/qtaudio_wasapi.dll +0 -0
  277. fast/plugins/audio/qtaudio_windows.dll +0 -0
  278. fast/plugins/bearer/qgenericbearer.dll +0 -0
  279. fast/plugins/generic/qtuiotouchplugin.dll +0 -0
  280. fast/plugins/iconengines/qsvgicon.dll +0 -0
  281. fast/plugins/imageformats/qgif.dll +0 -0
  282. fast/plugins/imageformats/qicns.dll +0 -0
  283. fast/plugins/imageformats/qico.dll +0 -0
  284. fast/plugins/imageformats/qjpeg.dll +0 -0
  285. fast/plugins/imageformats/qsvg.dll +0 -0
  286. fast/plugins/imageformats/qtga.dll +0 -0
  287. fast/plugins/imageformats/qtiff.dll +0 -0
  288. fast/plugins/imageformats/qwbmp.dll +0 -0
  289. fast/plugins/imageformats/qwebp.dll +0 -0
  290. fast/plugins/mediaservice/dsengine.dll +0 -0
  291. fast/plugins/mediaservice/qtmedia_audioengine.dll +0 -0
  292. fast/plugins/mediaservice/wmfengine.dll +0 -0
  293. fast/plugins/platforms/qdirect2d.dll +0 -0
  294. fast/plugins/platforms/qminimal.dll +0 -0
  295. fast/plugins/platforms/qoffscreen.dll +0 -0
  296. fast/plugins/platforms/qwindows.dll +0 -0
  297. fast/plugins/platformthemes/qxdgdesktopportal.dll +0 -0
  298. fast/plugins/playlistformats/qtmultimedia_m3u.dll +0 -0
  299. fast/plugins/printsupport/windowsprintersupport.dll +0 -0
  300. fast/plugins/sqldrivers/qsqlite.dll +0 -0
  301. fast/plugins/sqldrivers/qsqlodbc.dll +0 -0
  302. fast/plugins/styles/qwindowsvistastyle.dll +0 -0
  303. pyfast-4.12.0.dist-info/METADATA +81 -0
  304. pyfast-4.12.0.dist-info/RECORD +307 -0
  305. pyfast-4.12.0.dist-info/WHEEL +5 -0
  306. pyfast-4.12.0.dist-info/entry_points.txt +5 -0
  307. pyfast-4.12.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,739 @@
1
+ //#pragma OPENCL EXTENSION cl_amd_printf:enable
2
+
3
+ __constant sampler_t sampler = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP | CLK_FILTER_NEAREST;
4
+ __constant sampler_t sampler2 = CLK_NORMALIZED_COORDS_FALSE | CLK_ADDRESS_CLAMP_TO_EDGE | CLK_FILTER_NEAREST;
5
+
6
+ /* Morton Code Functions - Kudos to http://fgiesen.wordpress.com/2009/12/13/decoding-morton-codes/ */
7
+
8
+ // "Insert" two 0 bits after each of the 10 low bits of x
9
+ uint Part1By2(uint x) {
10
+ x &= 0x000003ff; // x = ---- ---- ---- ---- ---- --98 7654 3210
11
+ x = (x ^ (x << 16)) & 0xff0000ff; // x = ---- --98 ---- ---- ---- ---- 7654 3210
12
+ x = (x ^ (x << 8)) & 0x0300f00f; // x = ---- --98 ---- ---- 7654 ---- ---- 3210
13
+ x = (x ^ (x << 4)) & 0x030c30c3; // x = ---- --98 ---- 76-- --54 ---- 32-- --10
14
+ x = (x ^ (x << 2)) & 0x09249249; // x = ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
15
+ return x;
16
+ }
17
+
18
+ uint EncodeMorton3(uint x, uint y, uint z) {
19
+ return (Part1By2(z) << 2) + (Part1By2(y) << 1) + Part1By2(x);
20
+ }
21
+
22
+ uint EncodeMorton(int4 v) {
23
+ return EncodeMorton3(v.x,v.y,v.z);
24
+ }
25
+
26
+ // Inverse of Part1By2 - "delete" all bits not at positions divisible by 3
27
+ uint Compact1By2(uint x) {
28
+ x &= 0x09249249; // x = ---- 9--8 --7- -6-- 5--4 --3- -2-- 1--0
29
+ x = (x ^ (x >> 2)) & 0x030c30c3; // x = ---- --98 ---- 76-- --54 ---- 32-- --10
30
+ x = (x ^ (x >> 4)) & 0x0300f00f; // x = ---- --98 ---- ---- 7654 ---- ---- 3210
31
+ x = (x ^ (x >> 8)) & 0xff0000ff; // x = ---- --98 ---- ---- ---- ---- 7654 3210
32
+ x = (x ^ (x >> 16)) & 0x000003ff; // x = ---- ---- ---- ---- ---- --98 7654 3210
33
+ return x;
34
+ }
35
+
36
+ uint DecodeMorton3X(uint code) {
37
+ return Compact1By2(code >> 0);
38
+ }
39
+
40
+ uint DecodeMorton3Y(uint code) {
41
+ return Compact1By2(code >> 1);
42
+ }
43
+
44
+ uint DecodeMorton3Z(uint code) {
45
+ return Compact1By2(code >> 2);
46
+ }
47
+
48
+ __constant int4 cubeOffsets[8] = {
49
+ {0, 0, 0, 0},
50
+ {1, 0, 0, 0},
51
+ {0, 0, 1, 0},
52
+ {1, 0, 1, 0},
53
+ {0, 1, 0, 0},
54
+ {1, 1, 0, 0},
55
+ {0, 1, 1, 0},
56
+ {1, 1, 1, 0},
57
+ };
58
+
59
+ __kernel void constructHPLevelCharChar(
60
+ __global uchar * readHistoPyramid,
61
+ __global uchar * writeHistoPyramid
62
+ ) {
63
+
64
+ uint writePos = EncodeMorton3(get_global_id(0), get_global_id(1), get_global_id(2));
65
+ uint readPos = EncodeMorton3(get_global_id(0)*2, get_global_id(1)*2, get_global_id(2)*2);
66
+ uchar writeValue = readHistoPyramid[readPos] +
67
+ readHistoPyramid[readPos + 1] +
68
+ readHistoPyramid[readPos + 2] +
69
+ readHistoPyramid[readPos + 3] +
70
+ readHistoPyramid[readPos + 4] +
71
+ readHistoPyramid[readPos + 5] +
72
+ readHistoPyramid[readPos + 6] +
73
+ readHistoPyramid[readPos + 7];
74
+
75
+ writeHistoPyramid[writePos] = writeValue;
76
+ }
77
+
78
+ __kernel void constructHPLevelCharShort(
79
+ __global uchar * readHistoPyramid,
80
+ __global ushort * writeHistoPyramid
81
+ ) {
82
+
83
+ uint writePos = EncodeMorton3(get_global_id(0), get_global_id(1), get_global_id(2));
84
+ uint readPos = EncodeMorton3(get_global_id(0)*2, get_global_id(1)*2, get_global_id(2)*2);
85
+ ushort writeValue = readHistoPyramid[readPos] +
86
+ readHistoPyramid[readPos + 1] +
87
+ readHistoPyramid[readPos + 2] +
88
+ readHistoPyramid[readPos + 3] +
89
+ readHistoPyramid[readPos + 4] +
90
+ readHistoPyramid[readPos + 5] +
91
+ readHistoPyramid[readPos + 6] +
92
+ readHistoPyramid[readPos + 7];
93
+
94
+ writeHistoPyramid[writePos] = writeValue;
95
+ }
96
+ __kernel void constructHPLevelShortShort(
97
+ __global ushort * readHistoPyramid,
98
+ __global ushort * writeHistoPyramid
99
+ ) {
100
+
101
+ uint writePos = EncodeMorton3(get_global_id(0), get_global_id(1), get_global_id(2));
102
+ uint readPos = EncodeMorton3(get_global_id(0)*2, get_global_id(1)*2, get_global_id(2)*2);
103
+ ushort writeValue = readHistoPyramid[readPos] +
104
+ readHistoPyramid[readPos + 1] +
105
+ readHistoPyramid[readPos + 2] +
106
+ readHistoPyramid[readPos + 3] +
107
+ readHistoPyramid[readPos + 4] +
108
+ readHistoPyramid[readPos + 5] +
109
+ readHistoPyramid[readPos + 6] +
110
+ readHistoPyramid[readPos + 7];
111
+
112
+ writeHistoPyramid[writePos] = writeValue;
113
+ }
114
+
115
+ __kernel void constructHPLevelShortInt(
116
+ __global ushort * readHistoPyramid,
117
+ __global int * writeHistoPyramid
118
+ ) {
119
+
120
+ uint writePos = EncodeMorton3(get_global_id(0), get_global_id(1), get_global_id(2));
121
+ uint readPos = EncodeMorton3(get_global_id(0)*2, get_global_id(1)*2, get_global_id(2)*2);
122
+ int writeValue = readHistoPyramid[readPos] +
123
+ readHistoPyramid[readPos + 1] +
124
+ readHistoPyramid[readPos + 2] +
125
+ readHistoPyramid[readPos + 3] +
126
+ readHistoPyramid[readPos + 4] +
127
+ readHistoPyramid[readPos + 5] +
128
+ readHistoPyramid[readPos + 6] +
129
+ readHistoPyramid[readPos + 7];
130
+
131
+ writeHistoPyramid[writePos] = writeValue;
132
+ }
133
+
134
+ __kernel void constructHPLevel(
135
+ __global int * readHistoPyramid,
136
+ __global int * writeHistoPyramid
137
+ ) {
138
+
139
+ uint writePos = EncodeMorton3(get_global_id(0), get_global_id(1), get_global_id(2));
140
+ uint readPos = EncodeMorton3(get_global_id(0)*2, get_global_id(1)*2, get_global_id(2)*2);
141
+ int writeValue = readHistoPyramid[readPos] +
142
+ readHistoPyramid[readPos + 1] +
143
+ readHistoPyramid[readPos + 2] +
144
+ readHistoPyramid[readPos + 3] +
145
+ readHistoPyramid[readPos + 4] +
146
+ readHistoPyramid[readPos + 5] +
147
+ readHistoPyramid[readPos + 6] +
148
+ readHistoPyramid[readPos + 7];
149
+
150
+ writeHistoPyramid[writePos] = writeValue;
151
+ }
152
+
153
+ int4 scanHPLevelShort(int target, __global ushort * hp, int4 current) {
154
+
155
+ int8 neighbors = {
156
+ hp[EncodeMorton(current)],
157
+ hp[EncodeMorton(current + cubeOffsets[1])],
158
+ hp[EncodeMorton(current + cubeOffsets[2])],
159
+ hp[EncodeMorton(current + cubeOffsets[3])],
160
+ hp[EncodeMorton(current + cubeOffsets[4])],
161
+ hp[EncodeMorton(current + cubeOffsets[5])],
162
+ hp[EncodeMorton(current + cubeOffsets[6])],
163
+ hp[EncodeMorton(current + cubeOffsets[7])],
164
+ };
165
+
166
+ int acc = current.s3 + neighbors.s0;
167
+ int8 cmp;
168
+ cmp.s0 = acc <= target;
169
+ acc += neighbors.s1;
170
+ cmp.s1 = acc <= target;
171
+ acc += neighbors.s2;
172
+ cmp.s2 = acc <= target;
173
+ acc += neighbors.s3;
174
+ cmp.s3 = acc <= target;
175
+ acc += neighbors.s4;
176
+ cmp.s4 = acc <= target;
177
+ acc += neighbors.s5;
178
+ cmp.s5 = acc <= target;
179
+ acc += neighbors.s6;
180
+ cmp.s6 = acc <= target;
181
+ cmp.s7 = 0;
182
+
183
+
184
+ current += cubeOffsets[(cmp.s0+cmp.s1+cmp.s2+cmp.s3+cmp.s4+cmp.s5+cmp.s6+cmp.s7)];
185
+ current.s0 = current.s0*2;
186
+ current.s1 = current.s1*2;
187
+ current.s2 = current.s2*2;
188
+ current.s3 = current.s3 +
189
+ cmp.s0*neighbors.s0 +
190
+ cmp.s1*neighbors.s1 +
191
+ cmp.s2*neighbors.s2 +
192
+ cmp.s3*neighbors.s3 +
193
+ cmp.s4*neighbors.s4 +
194
+ cmp.s5*neighbors.s5 +
195
+ cmp.s6*neighbors.s6 +
196
+ cmp.s7*neighbors.s7;
197
+ return current;
198
+
199
+ }
200
+ int4 scanHPLevelChar(int target, __global uchar * hp, int4 current) {
201
+
202
+ int8 neighbors = {
203
+ hp[EncodeMorton(current)],
204
+ hp[EncodeMorton(current + cubeOffsets[1])],
205
+ hp[EncodeMorton(current + cubeOffsets[2])],
206
+ hp[EncodeMorton(current + cubeOffsets[3])],
207
+ hp[EncodeMorton(current + cubeOffsets[4])],
208
+ hp[EncodeMorton(current + cubeOffsets[5])],
209
+ hp[EncodeMorton(current + cubeOffsets[6])],
210
+ hp[EncodeMorton(current + cubeOffsets[7])],
211
+ };
212
+
213
+ int acc = current.s3 + neighbors.s0;
214
+ int8 cmp;
215
+ cmp.s0 = acc <= target;
216
+ acc += neighbors.s1;
217
+ cmp.s1 = acc <= target;
218
+ acc += neighbors.s2;
219
+ cmp.s2 = acc <= target;
220
+ acc += neighbors.s3;
221
+ cmp.s3 = acc <= target;
222
+ acc += neighbors.s4;
223
+ cmp.s4 = acc <= target;
224
+ acc += neighbors.s5;
225
+ cmp.s5 = acc <= target;
226
+ acc += neighbors.s6;
227
+ cmp.s6 = acc <= target;
228
+ cmp.s7 = 0;
229
+
230
+
231
+ current += cubeOffsets[(cmp.s0+cmp.s1+cmp.s2+cmp.s3+cmp.s4+cmp.s5+cmp.s6+cmp.s7)];
232
+ current.s0 = current.s0*2;
233
+ current.s1 = current.s1*2;
234
+ current.s2 = current.s2*2;
235
+ current.s3 = current.s3 +
236
+ cmp.s0*neighbors.s0 +
237
+ cmp.s1*neighbors.s1 +
238
+ cmp.s2*neighbors.s2 +
239
+ cmp.s3*neighbors.s3 +
240
+ cmp.s4*neighbors.s4 +
241
+ cmp.s5*neighbors.s5 +
242
+ cmp.s6*neighbors.s6 +
243
+ cmp.s7*neighbors.s7;
244
+ return current;
245
+
246
+ }
247
+
248
+ int4 scanHPLevel(int target, __global int * hp, int4 current) {
249
+
250
+ int8 neighbors = {
251
+ hp[EncodeMorton(current)],
252
+ hp[EncodeMorton(current + cubeOffsets[1])],
253
+ hp[EncodeMorton(current + cubeOffsets[2])],
254
+ hp[EncodeMorton(current + cubeOffsets[3])],
255
+ hp[EncodeMorton(current + cubeOffsets[4])],
256
+ hp[EncodeMorton(current + cubeOffsets[5])],
257
+ hp[EncodeMorton(current + cubeOffsets[6])],
258
+ hp[EncodeMorton(current + cubeOffsets[7])],
259
+ };
260
+
261
+ int acc = current.s3 + neighbors.s0;
262
+ int8 cmp;
263
+ cmp.s0 = acc <= target;
264
+ acc += neighbors.s1;
265
+ cmp.s1 = acc <= target;
266
+ acc += neighbors.s2;
267
+ cmp.s2 = acc <= target;
268
+ acc += neighbors.s3;
269
+ cmp.s3 = acc <= target;
270
+ acc += neighbors.s4;
271
+ cmp.s4 = acc <= target;
272
+ acc += neighbors.s5;
273
+ cmp.s5 = acc <= target;
274
+ acc += neighbors.s6;
275
+ cmp.s6 = acc <= target;
276
+ cmp.s7 = 0;
277
+
278
+
279
+ current += cubeOffsets[(cmp.s0+cmp.s1+cmp.s2+cmp.s3+cmp.s4+cmp.s5+cmp.s6+cmp.s7)];
280
+ current.s0 = current.s0*2;
281
+ current.s1 = current.s1*2;
282
+ current.s2 = current.s2*2;
283
+ current.s3 = current.s3 +
284
+ cmp.s0*neighbors.s0 +
285
+ cmp.s1*neighbors.s1 +
286
+ cmp.s2*neighbors.s2 +
287
+ cmp.s3*neighbors.s3 +
288
+ cmp.s4*neighbors.s4 +
289
+ cmp.s5*neighbors.s5 +
290
+ cmp.s6*neighbors.s6 +
291
+ cmp.s7*neighbors.s7;
292
+ return current;
293
+
294
+ }
295
+
296
+
297
+ __constant char offsets3[72] = {
298
+ // 0
299
+ 0,0,0,
300
+ 1,0,0,
301
+ // 1
302
+ 1,0,0,
303
+ 1,0,1,
304
+ // 2
305
+ 1,0,1,
306
+ 0,0,1,
307
+ // 3
308
+ 0,0,1,
309
+ 0,0,0,
310
+ // 4
311
+ 0,1,0,
312
+ 1,1,0,
313
+ // 5
314
+ 1,1,0,
315
+ 1,1,1,
316
+ // 6
317
+ 1,1,1,
318
+ 0,1,1,
319
+ // 7
320
+ 0,1,1,
321
+ 0,1,0,
322
+ // 8
323
+ 0,0,0,
324
+ 0,1,0,
325
+ // 9
326
+ 1,0,0,
327
+ 1,1,0,
328
+ // 10
329
+ 1,0,1,
330
+ 1,1,1,
331
+ // 11
332
+ 0,0,1,
333
+ 0,1,1
334
+ };
335
+
336
+ __constant char triTable[4096] =
337
+ {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
338
+ 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
339
+ 0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
340
+ 1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
341
+ 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
342
+ 0, 8, 3, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
343
+ 9, 2, 10, 0, 2, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
344
+ 2, 8, 3, 2, 10, 8, 10, 9, 8, -1, -1, -1, -1, -1, -1, -1,
345
+ 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
346
+ 0, 11, 2, 8, 11, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
347
+ 1, 9, 0, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
348
+ 1, 11, 2, 1, 9, 11, 9, 8, 11, -1, -1, -1, -1, -1, -1, -1,
349
+ 3, 10, 1, 11, 10, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
350
+ 0, 10, 1, 0, 8, 10, 8, 11, 10, -1, -1, -1, -1, -1, -1, -1,
351
+ 3, 9, 0, 3, 11, 9, 11, 10, 9, -1, -1, -1, -1, -1, -1, -1,
352
+ 9, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
353
+ 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
354
+ 4, 3, 0, 7, 3, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
355
+ 0, 1, 9, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
356
+ 4, 1, 9, 4, 7, 1, 7, 3, 1, -1, -1, -1, -1, -1, -1, -1,
357
+ 1, 2, 10, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
358
+ 3, 4, 7, 3, 0, 4, 1, 2, 10, -1, -1, -1, -1, -1, -1, -1,
359
+ 9, 2, 10, 9, 0, 2, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,
360
+ 2, 10, 9, 2, 9, 7, 2, 7, 3, 7, 9, 4, -1, -1, -1, -1,
361
+ 8, 4, 7, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
362
+ 11, 4, 7, 11, 2, 4, 2, 0, 4, -1, -1, -1, -1, -1, -1, -1,
363
+ 9, 0, 1, 8, 4, 7, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,
364
+ 4, 7, 11, 9, 4, 11, 9, 11, 2, 9, 2, 1, -1, -1, -1, -1,
365
+ 3, 10, 1, 3, 11, 10, 7, 8, 4, -1, -1, -1, -1, -1, -1, -1,
366
+ 1, 11, 10, 1, 4, 11, 1, 0, 4, 7, 11, 4, -1, -1, -1, -1,
367
+ 4, 7, 8, 9, 0, 11, 9, 11, 10, 11, 0, 3, -1, -1, -1, -1,
368
+ 4, 7, 11, 4, 11, 9, 9, 11, 10, -1, -1, -1, -1, -1, -1, -1,
369
+ 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
370
+ 9, 5, 4, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
371
+ 0, 5, 4, 1, 5, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
372
+ 8, 5, 4, 8, 3, 5, 3, 1, 5, -1, -1, -1, -1, -1, -1, -1,
373
+ 1, 2, 10, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
374
+ 3, 0, 8, 1, 2, 10, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,
375
+ 5, 2, 10, 5, 4, 2, 4, 0, 2, -1, -1, -1, -1, -1, -1, -1,
376
+ 2, 10, 5, 3, 2, 5, 3, 5, 4, 3, 4, 8, -1, -1, -1, -1,
377
+ 9, 5, 4, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
378
+ 0, 11, 2, 0, 8, 11, 4, 9, 5, -1, -1, -1, -1, -1, -1, -1,
379
+ 0, 5, 4, 0, 1, 5, 2, 3, 11, -1, -1, -1, -1, -1, -1, -1,
380
+ 2, 1, 5, 2, 5, 8, 2, 8, 11, 4, 8, 5, -1, -1, -1, -1,
381
+ 10, 3, 11, 10, 1, 3, 9, 5, 4, -1, -1, -1, -1, -1, -1, -1,
382
+ 4, 9, 5, 0, 8, 1, 8, 10, 1, 8, 11, 10, -1, -1, -1, -1,
383
+ 5, 4, 0, 5, 0, 11, 5, 11, 10, 11, 0, 3, -1, -1, -1, -1,
384
+ 5, 4, 8, 5, 8, 10, 10, 8, 11, -1, -1, -1, -1, -1, -1, -1,
385
+ 9, 7, 8, 5, 7, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
386
+ 9, 3, 0, 9, 5, 3, 5, 7, 3, -1, -1, -1, -1, -1, -1, -1,
387
+ 0, 7, 8, 0, 1, 7, 1, 5, 7, -1, -1, -1, -1, -1, -1, -1,
388
+ 1, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
389
+ 9, 7, 8, 9, 5, 7, 10, 1, 2, -1, -1, -1, -1, -1, -1, -1,
390
+ 10, 1, 2, 9, 5, 0, 5, 3, 0, 5, 7, 3, -1, -1, -1, -1,
391
+ 8, 0, 2, 8, 2, 5, 8, 5, 7, 10, 5, 2, -1, -1, -1, -1,
392
+ 2, 10, 5, 2, 5, 3, 3, 5, 7, -1, -1, -1, -1, -1, -1, -1,
393
+ 7, 9, 5, 7, 8, 9, 3, 11, 2, -1, -1, -1, -1, -1, -1, -1,
394
+ 9, 5, 7, 9, 7, 2, 9, 2, 0, 2, 7, 11, -1, -1, -1, -1,
395
+ 2, 3, 11, 0, 1, 8, 1, 7, 8, 1, 5, 7, -1, -1, -1, -1,
396
+ 11, 2, 1, 11, 1, 7, 7, 1, 5, -1, -1, -1, -1, -1, -1, -1,
397
+ 9, 5, 8, 8, 5, 7, 10, 1, 3, 10, 3, 11, -1, -1, -1, -1,
398
+ 5, 7, 0, 5, 0, 9, 7, 11, 0, 1, 0, 10, 11, 10, 0, -1,
399
+ 11, 10, 0, 11, 0, 3, 10, 5, 0, 8, 0, 7, 5, 7, 0, -1,
400
+ 11, 10, 5, 7, 11, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
401
+ 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
402
+ 0, 8, 3, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
403
+ 9, 0, 1, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
404
+ 1, 8, 3, 1, 9, 8, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,
405
+ 1, 6, 5, 2, 6, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
406
+ 1, 6, 5, 1, 2, 6, 3, 0, 8, -1, -1, -1, -1, -1, -1, -1,
407
+ 9, 6, 5, 9, 0, 6, 0, 2, 6, -1, -1, -1, -1, -1, -1, -1,
408
+ 5, 9, 8, 5, 8, 2, 5, 2, 6, 3, 2, 8, -1, -1, -1, -1,
409
+ 2, 3, 11, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
410
+ 11, 0, 8, 11, 2, 0, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,
411
+ 0, 1, 9, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1, -1, -1, -1,
412
+ 5, 10, 6, 1, 9, 2, 9, 11, 2, 9, 8, 11, -1, -1, -1, -1,
413
+ 6, 3, 11, 6, 5, 3, 5, 1, 3, -1, -1, -1, -1, -1, -1, -1,
414
+ 0, 8, 11, 0, 11, 5, 0, 5, 1, 5, 11, 6, -1, -1, -1, -1,
415
+ 3, 11, 6, 0, 3, 6, 0, 6, 5, 0, 5, 9, -1, -1, -1, -1,
416
+ 6, 5, 9, 6, 9, 11, 11, 9, 8, -1, -1, -1, -1, -1, -1, -1,
417
+ 5, 10, 6, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
418
+ 4, 3, 0, 4, 7, 3, 6, 5, 10, -1, -1, -1, -1, -1, -1, -1,
419
+ 1, 9, 0, 5, 10, 6, 8, 4, 7, -1, -1, -1, -1, -1, -1, -1,
420
+ 10, 6, 5, 1, 9, 7, 1, 7, 3, 7, 9, 4, -1, -1, -1, -1,
421
+ 6, 1, 2, 6, 5, 1, 4, 7, 8, -1, -1, -1, -1, -1, -1, -1,
422
+ 1, 2, 5, 5, 2, 6, 3, 0, 4, 3, 4, 7, -1, -1, -1, -1,
423
+ 8, 4, 7, 9, 0, 5, 0, 6, 5, 0, 2, 6, -1, -1, -1, -1,
424
+ 7, 3, 9, 7, 9, 4, 3, 2, 9, 5, 9, 6, 2, 6, 9, -1,
425
+ 3, 11, 2, 7, 8, 4, 10, 6, 5, -1, -1, -1, -1, -1, -1, -1,
426
+ 5, 10, 6, 4, 7, 2, 4, 2, 0, 2, 7, 11, -1, -1, -1, -1,
427
+ 0, 1, 9, 4, 7, 8, 2, 3, 11, 5, 10, 6, -1, -1, -1, -1,
428
+ 9, 2, 1, 9, 11, 2, 9, 4, 11, 7, 11, 4, 5, 10, 6, -1,
429
+ 8, 4, 7, 3, 11, 5, 3, 5, 1, 5, 11, 6, -1, -1, -1, -1,
430
+ 5, 1, 11, 5, 11, 6, 1, 0, 11, 7, 11, 4, 0, 4, 11, -1,
431
+ 0, 5, 9, 0, 6, 5, 0, 3, 6, 11, 6, 3, 8, 4, 7, -1,
432
+ 6, 5, 9, 6, 9, 11, 4, 7, 9, 7, 11, 9, -1, -1, -1, -1,
433
+ 10, 4, 9, 6, 4, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
434
+ 4, 10, 6, 4, 9, 10, 0, 8, 3, -1, -1, -1, -1, -1, -1, -1,
435
+ 10, 0, 1, 10, 6, 0, 6, 4, 0, -1, -1, -1, -1, -1, -1, -1,
436
+ 8, 3, 1, 8, 1, 6, 8, 6, 4, 6, 1, 10, -1, -1, -1, -1,
437
+ 1, 4, 9, 1, 2, 4, 2, 6, 4, -1, -1, -1, -1, -1, -1, -1,
438
+ 3, 0, 8, 1, 2, 9, 2, 4, 9, 2, 6, 4, -1, -1, -1, -1,
439
+ 0, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
440
+ 8, 3, 2, 8, 2, 4, 4, 2, 6, -1, -1, -1, -1, -1, -1, -1,
441
+ 10, 4, 9, 10, 6, 4, 11, 2, 3, -1, -1, -1, -1, -1, -1, -1,
442
+ 0, 8, 2, 2, 8, 11, 4, 9, 10, 4, 10, 6, -1, -1, -1, -1,
443
+ 3, 11, 2, 0, 1, 6, 0, 6, 4, 6, 1, 10, -1, -1, -1, -1,
444
+ 6, 4, 1, 6, 1, 10, 4, 8, 1, 2, 1, 11, 8, 11, 1, -1,
445
+ 9, 6, 4, 9, 3, 6, 9, 1, 3, 11, 6, 3, -1, -1, -1, -1,
446
+ 8, 11, 1, 8, 1, 0, 11, 6, 1, 9, 1, 4, 6, 4, 1, -1,
447
+ 3, 11, 6, 3, 6, 0, 0, 6, 4, -1, -1, -1, -1, -1, -1, -1,
448
+ 6, 4, 8, 11, 6, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
449
+ 7, 10, 6, 7, 8, 10, 8, 9, 10, -1, -1, -1, -1, -1, -1, -1,
450
+ 0, 7, 3, 0, 10, 7, 0, 9, 10, 6, 7, 10, -1, -1, -1, -1,
451
+ 10, 6, 7, 1, 10, 7, 1, 7, 8, 1, 8, 0, -1, -1, -1, -1,
452
+ 10, 6, 7, 10, 7, 1, 1, 7, 3, -1, -1, -1, -1, -1, -1, -1,
453
+ 1, 2, 6, 1, 6, 8, 1, 8, 9, 8, 6, 7, -1, -1, -1, -1,
454
+ 2, 6, 9, 2, 9, 1, 6, 7, 9, 0, 9, 3, 7, 3, 9, -1,
455
+ 7, 8, 0, 7, 0, 6, 6, 0, 2, -1, -1, -1, -1, -1, -1, -1,
456
+ 7, 3, 2, 6, 7, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
457
+ 2, 3, 11, 10, 6, 8, 10, 8, 9, 8, 6, 7, -1, -1, -1, -1,
458
+ 2, 0, 7, 2, 7, 11, 0, 9, 7, 6, 7, 10, 9, 10, 7, -1,
459
+ 1, 8, 0, 1, 7, 8, 1, 10, 7, 6, 7, 10, 2, 3, 11, -1,
460
+ 11, 2, 1, 11, 1, 7, 10, 6, 1, 6, 7, 1, -1, -1, -1, -1,
461
+ 8, 9, 6, 8, 6, 7, 9, 1, 6, 11, 6, 3, 1, 3, 6, -1,
462
+ 0, 9, 1, 11, 6, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
463
+ 7, 8, 0, 7, 0, 6, 3, 11, 0, 11, 6, 0, -1, -1, -1, -1,
464
+ 7, 11, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
465
+ 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
466
+ 3, 0, 8, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
467
+ 0, 1, 9, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
468
+ 8, 1, 9, 8, 3, 1, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,
469
+ 10, 1, 2, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
470
+ 1, 2, 10, 3, 0, 8, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,
471
+ 2, 9, 0, 2, 10, 9, 6, 11, 7, -1, -1, -1, -1, -1, -1, -1,
472
+ 6, 11, 7, 2, 10, 3, 10, 8, 3, 10, 9, 8, -1, -1, -1, -1,
473
+ 7, 2, 3, 6, 2, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
474
+ 7, 0, 8, 7, 6, 0, 6, 2, 0, -1, -1, -1, -1, -1, -1, -1,
475
+ 2, 7, 6, 2, 3, 7, 0, 1, 9, -1, -1, -1, -1, -1, -1, -1,
476
+ 1, 6, 2, 1, 8, 6, 1, 9, 8, 8, 7, 6, -1, -1, -1, -1,
477
+ 10, 7, 6, 10, 1, 7, 1, 3, 7, -1, -1, -1, -1, -1, -1, -1,
478
+ 10, 7, 6, 1, 7, 10, 1, 8, 7, 1, 0, 8, -1, -1, -1, -1,
479
+ 0, 3, 7, 0, 7, 10, 0, 10, 9, 6, 10, 7, -1, -1, -1, -1,
480
+ 7, 6, 10, 7, 10, 8, 8, 10, 9, -1, -1, -1, -1, -1, -1, -1,
481
+ 6, 8, 4, 11, 8, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
482
+ 3, 6, 11, 3, 0, 6, 0, 4, 6, -1, -1, -1, -1, -1, -1, -1,
483
+ 8, 6, 11, 8, 4, 6, 9, 0, 1, -1, -1, -1, -1, -1, -1, -1,
484
+ 9, 4, 6, 9, 6, 3, 9, 3, 1, 11, 3, 6, -1, -1, -1, -1,
485
+ 6, 8, 4, 6, 11, 8, 2, 10, 1, -1, -1, -1, -1, -1, -1, -1,
486
+ 1, 2, 10, 3, 0, 11, 0, 6, 11, 0, 4, 6, -1, -1, -1, -1,
487
+ 4, 11, 8, 4, 6, 11, 0, 2, 9, 2, 10, 9, -1, -1, -1, -1,
488
+ 10, 9, 3, 10, 3, 2, 9, 4, 3, 11, 3, 6, 4, 6, 3, -1,
489
+ 8, 2, 3, 8, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1,
490
+ 0, 4, 2, 4, 6, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
491
+ 1, 9, 0, 2, 3, 4, 2, 4, 6, 4, 3, 8, -1, -1, -1, -1,
492
+ 1, 9, 4, 1, 4, 2, 2, 4, 6, -1, -1, -1, -1, -1, -1, -1,
493
+ 8, 1, 3, 8, 6, 1, 8, 4, 6, 6, 10, 1, -1, -1, -1, -1,
494
+ 10, 1, 0, 10, 0, 6, 6, 0, 4, -1, -1, -1, -1, -1, -1, -1,
495
+ 4, 6, 3, 4, 3, 8, 6, 10, 3, 0, 3, 9, 10, 9, 3, -1,
496
+ 10, 9, 4, 6, 10, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
497
+ 4, 9, 5, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
498
+ 0, 8, 3, 4, 9, 5, 11, 7, 6, -1, -1, -1, -1, -1, -1, -1,
499
+ 5, 0, 1, 5, 4, 0, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,
500
+ 11, 7, 6, 8, 3, 4, 3, 5, 4, 3, 1, 5, -1, -1, -1, -1,
501
+ 9, 5, 4, 10, 1, 2, 7, 6, 11, -1, -1, -1, -1, -1, -1, -1,
502
+ 6, 11, 7, 1, 2, 10, 0, 8, 3, 4, 9, 5, -1, -1, -1, -1,
503
+ 7, 6, 11, 5, 4, 10, 4, 2, 10, 4, 0, 2, -1, -1, -1, -1,
504
+ 3, 4, 8, 3, 5, 4, 3, 2, 5, 10, 5, 2, 11, 7, 6, -1,
505
+ 7, 2, 3, 7, 6, 2, 5, 4, 9, -1, -1, -1, -1, -1, -1, -1,
506
+ 9, 5, 4, 0, 8, 6, 0, 6, 2, 6, 8, 7, -1, -1, -1, -1,
507
+ 3, 6, 2, 3, 7, 6, 1, 5, 0, 5, 4, 0, -1, -1, -1, -1,
508
+ 6, 2, 8, 6, 8, 7, 2, 1, 8, 4, 8, 5, 1, 5, 8, -1,
509
+ 9, 5, 4, 10, 1, 6, 1, 7, 6, 1, 3, 7, -1, -1, -1, -1,
510
+ 1, 6, 10, 1, 7, 6, 1, 0, 7, 8, 7, 0, 9, 5, 4, -1,
511
+ 4, 0, 10, 4, 10, 5, 0, 3, 10, 6, 10, 7, 3, 7, 10, -1,
512
+ 7, 6, 10, 7, 10, 8, 5, 4, 10, 4, 8, 10, -1, -1, -1, -1,
513
+ 6, 9, 5, 6, 11, 9, 11, 8, 9, -1, -1, -1, -1, -1, -1, -1,
514
+ 3, 6, 11, 0, 6, 3, 0, 5, 6, 0, 9, 5, -1, -1, -1, -1,
515
+ 0, 11, 8, 0, 5, 11, 0, 1, 5, 5, 6, 11, -1, -1, -1, -1,
516
+ 6, 11, 3, 6, 3, 5, 5, 3, 1, -1, -1, -1, -1, -1, -1, -1,
517
+ 1, 2, 10, 9, 5, 11, 9, 11, 8, 11, 5, 6, -1, -1, -1, -1,
518
+ 0, 11, 3, 0, 6, 11, 0, 9, 6, 5, 6, 9, 1, 2, 10, -1,
519
+ 11, 8, 5, 11, 5, 6, 8, 0, 5, 10, 5, 2, 0, 2, 5, -1,
520
+ 6, 11, 3, 6, 3, 5, 2, 10, 3, 10, 5, 3, -1, -1, -1, -1,
521
+ 5, 8, 9, 5, 2, 8, 5, 6, 2, 3, 8, 2, -1, -1, -1, -1,
522
+ 9, 5, 6, 9, 6, 0, 0, 6, 2, -1, -1, -1, -1, -1, -1, -1,
523
+ 1, 5, 8, 1, 8, 0, 5, 6, 8, 3, 8, 2, 6, 2, 8, -1,
524
+ 1, 5, 6, 2, 1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
525
+ 1, 3, 6, 1, 6, 10, 3, 8, 6, 5, 6, 9, 8, 9, 6, -1,
526
+ 10, 1, 0, 10, 0, 6, 9, 5, 0, 5, 6, 0, -1, -1, -1, -1,
527
+ 0, 3, 8, 5, 6, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
528
+ 10, 5, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
529
+ 11, 5, 10, 7, 5, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
530
+ 11, 5, 10, 11, 7, 5, 8, 3, 0, -1, -1, -1, -1, -1, -1, -1,
531
+ 5, 11, 7, 5, 10, 11, 1, 9, 0, -1, -1, -1, -1, -1, -1, -1,
532
+ 10, 7, 5, 10, 11, 7, 9, 8, 1, 8, 3, 1, -1, -1, -1, -1,
533
+ 11, 1, 2, 11, 7, 1, 7, 5, 1, -1, -1, -1, -1, -1, -1, -1,
534
+ 0, 8, 3, 1, 2, 7, 1, 7, 5, 7, 2, 11, -1, -1, -1, -1,
535
+ 9, 7, 5, 9, 2, 7, 9, 0, 2, 2, 11, 7, -1, -1, -1, -1,
536
+ 7, 5, 2, 7, 2, 11, 5, 9, 2, 3, 2, 8, 9, 8, 2, -1,
537
+ 2, 5, 10, 2, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1,
538
+ 8, 2, 0, 8, 5, 2, 8, 7, 5, 10, 2, 5, -1, -1, -1, -1,
539
+ 9, 0, 1, 5, 10, 3, 5, 3, 7, 3, 10, 2, -1, -1, -1, -1,
540
+ 9, 8, 2, 9, 2, 1, 8, 7, 2, 10, 2, 5, 7, 5, 2, -1,
541
+ 1, 3, 5, 3, 7, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
542
+ 0, 8, 7, 0, 7, 1, 1, 7, 5, -1, -1, -1, -1, -1, -1, -1,
543
+ 9, 0, 3, 9, 3, 5, 5, 3, 7, -1, -1, -1, -1, -1, -1, -1,
544
+ 9, 8, 7, 5, 9, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
545
+ 5, 8, 4, 5, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1,
546
+ 5, 0, 4, 5, 11, 0, 5, 10, 11, 11, 3, 0, -1, -1, -1, -1,
547
+ 0, 1, 9, 8, 4, 10, 8, 10, 11, 10, 4, 5, -1, -1, -1, -1,
548
+ 10, 11, 4, 10, 4, 5, 11, 3, 4, 9, 4, 1, 3, 1, 4, -1,
549
+ 2, 5, 1, 2, 8, 5, 2, 11, 8, 4, 5, 8, -1, -1, -1, -1,
550
+ 0, 4, 11, 0, 11, 3, 4, 5, 11, 2, 11, 1, 5, 1, 11, -1,
551
+ 0, 2, 5, 0, 5, 9, 2, 11, 5, 4, 5, 8, 11, 8, 5, -1,
552
+ 9, 4, 5, 2, 11, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
553
+ 2, 5, 10, 3, 5, 2, 3, 4, 5, 3, 8, 4, -1, -1, -1, -1,
554
+ 5, 10, 2, 5, 2, 4, 4, 2, 0, -1, -1, -1, -1, -1, -1, -1,
555
+ 3, 10, 2, 3, 5, 10, 3, 8, 5, 4, 5, 8, 0, 1, 9, -1,
556
+ 5, 10, 2, 5, 2, 4, 1, 9, 2, 9, 4, 2, -1, -1, -1, -1,
557
+ 8, 4, 5, 8, 5, 3, 3, 5, 1, -1, -1, -1, -1, -1, -1, -1,
558
+ 0, 4, 5, 1, 0, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
559
+ 8, 4, 5, 8, 5, 3, 9, 0, 5, 0, 3, 5, -1, -1, -1, -1,
560
+ 9, 4, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
561
+ 4, 11, 7, 4, 9, 11, 9, 10, 11, -1, -1, -1, -1, -1, -1, -1,
562
+ 0, 8, 3, 4, 9, 7, 9, 11, 7, 9, 10, 11, -1, -1, -1, -1,
563
+ 1, 10, 11, 1, 11, 4, 1, 4, 0, 7, 4, 11, -1, -1, -1, -1,
564
+ 3, 1, 4, 3, 4, 8, 1, 10, 4, 7, 4, 11, 10, 11, 4, -1,
565
+ 4, 11, 7, 9, 11, 4, 9, 2, 11, 9, 1, 2, -1, -1, -1, -1,
566
+ 9, 7, 4, 9, 11, 7, 9, 1, 11, 2, 11, 1, 0, 8, 3, -1,
567
+ 11, 7, 4, 11, 4, 2, 2, 4, 0, -1, -1, -1, -1, -1, -1, -1,
568
+ 11, 7, 4, 11, 4, 2, 8, 3, 4, 3, 2, 4, -1, -1, -1, -1,
569
+ 2, 9, 10, 2, 7, 9, 2, 3, 7, 7, 4, 9, -1, -1, -1, -1,
570
+ 9, 10, 7, 9, 7, 4, 10, 2, 7, 8, 7, 0, 2, 0, 7, -1,
571
+ 3, 7, 10, 3, 10, 2, 7, 4, 10, 1, 10, 0, 4, 0, 10, -1,
572
+ 1, 10, 2, 8, 7, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
573
+ 4, 9, 1, 4, 1, 7, 7, 1, 3, -1, -1, -1, -1, -1, -1, -1,
574
+ 4, 9, 1, 4, 1, 7, 0, 8, 1, 8, 7, 1, -1, -1, -1, -1,
575
+ 4, 0, 3, 7, 4, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
576
+ 4, 8, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
577
+ 9, 10, 8, 10, 11, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
578
+ 3, 0, 9, 3, 9, 11, 11, 9, 10, -1, -1, -1, -1, -1, -1, -1,
579
+ 0, 1, 10, 0, 10, 8, 8, 10, 11, -1, -1, -1, -1, -1, -1, -1,
580
+ 3, 1, 10, 11, 3, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
581
+ 1, 2, 11, 1, 11, 9, 9, 11, 8, -1, -1, -1, -1, -1, -1, -1,
582
+ 3, 0, 9, 3, 9, 11, 1, 2, 9, 2, 11, 9, -1, -1, -1, -1,
583
+ 0, 2, 11, 8, 0, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
584
+ 3, 2, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
585
+ 2, 3, 8, 2, 8, 10, 10, 8, 9, -1, -1, -1, -1, -1, -1, -1,
586
+ 9, 10, 2, 0, 9, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
587
+ 2, 3, 8, 2, 8, 10, 0, 1, 8, 1, 10, 8, -1, -1, -1, -1,
588
+ 1, 10, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
589
+ 1, 3, 8, 9, 1, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
590
+ 0, 9, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
591
+ 0, 3, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
592
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
593
+
594
+ #ifdef TYPE_UINT
595
+ #define READ_RAW_DATA (float)read_imageui
596
+ #elif TYPE_INT
597
+ #define READ_RAW_DATA (float)read_imagei
598
+ #else
599
+ #define READ_RAW_DATA read_imagef
600
+ #endif
601
+
602
+ __kernel void traverseHP(
603
+ __read_only image3d_t rawData,
604
+ __global uchar* cubeIndexes,
605
+ __global uchar * hp0, // Largest HP
606
+ __global uchar * hp1,
607
+ __global ushort * hp2,
608
+ __global ushort * hp3,
609
+ __global ushort * hp4,
610
+ __global int * hp5,
611
+ #if SIZE > 64
612
+ __global int * hp6,
613
+ #endif
614
+ #if SIZE > 128
615
+ __global int * hp7,
616
+ #endif
617
+ #if SIZE > 256
618
+ __global int * hp8,
619
+ #endif
620
+ #if SIZE > 512
621
+ __global int * hp9,
622
+ #endif
623
+ __global float * coordinatesVBOBuffer,
624
+ __global float * normalVBOBuffer,
625
+ __private float isolevel,
626
+ __private int sum,
627
+ __private float spacing_x,
628
+ __private float spacing_y,
629
+ __private float spacing_z
630
+ ) {
631
+
632
+ int target = get_global_id(0);
633
+ if(target >= sum)
634
+ target = 0;
635
+
636
+ int4 cubePosition = {0,0,0,0}; // x,y,z,sum
637
+ #if SIZE > 512
638
+ cubePosition = scanHPLevel(target, hp9, cubePosition);
639
+ #endif
640
+ #if SIZE > 256
641
+ cubePosition = scanHPLevel(target, hp8, cubePosition);
642
+ #endif
643
+ #if SIZE > 128
644
+ cubePosition = scanHPLevel(target, hp7, cubePosition);
645
+ #endif
646
+ #if SIZE > 64
647
+ cubePosition = scanHPLevel(target, hp6, cubePosition);
648
+ #endif
649
+ cubePosition = scanHPLevel(target, hp5, cubePosition);
650
+ cubePosition = scanHPLevelShort(target, hp4, cubePosition);
651
+ cubePosition = scanHPLevelShort(target, hp3, cubePosition);
652
+ cubePosition = scanHPLevelShort(target, hp2, cubePosition);
653
+ cubePosition = scanHPLevelChar(target, hp1, cubePosition);
654
+ cubePosition = scanHPLevelChar(target, hp0, cubePosition);
655
+ cubePosition.x = cubePosition.x / 2;
656
+ cubePosition.y = cubePosition.y / 2;
657
+ cubePosition.z = cubePosition.z / 2;
658
+
659
+ char vertexNr = 0;
660
+
661
+ // max 5 triangles
662
+ uchar cubeindex = cubeIndexes[cubePosition.x+cubePosition.y*SIZE+cubePosition.z*SIZE*SIZE];
663
+ for(int i = (target-cubePosition.s3)*3; i < (target-cubePosition.s3+1)*3; i++) { // for each vertex in triangle
664
+ const uchar edge = triTable[cubeindex*16 + i];
665
+ const int3 point0 = (int3)(cubePosition.x + offsets3[edge*6], cubePosition.y + offsets3[edge*6+1], cubePosition.z + offsets3[edge*6+2]);
666
+ const int3 point1 = (int3)(cubePosition.x + offsets3[edge*6+3], cubePosition.y + offsets3[edge*6+4], cubePosition.z + offsets3[edge*6+5]);
667
+
668
+ // Store vertex in VBO
669
+
670
+ // TODO Should use spacing in these calculations:
671
+ float3 spacing = {spacing_x, spacing_y, spacing_z};
672
+ const float3 forwardDifference0 = (float3)(
673
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point0.x+1, point0.y, point0.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point0.x-1, point0.y, point0.z, 0)).x),
674
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y+1, point0.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y-1, point0.z, 0)).x),
675
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y, point0.z+1, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y, point0.z-1, 0)).x)
676
+ );
677
+ const float3 forwardDifference1 = (float3)(
678
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point1.x+1, point1.y, point1.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point1.x-1, point1.y, point1.z, 0)).x),
679
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y+1, point1.z, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y-1, point1.z, 0)).x),
680
+ (-READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y, point1.z+1, 0)).x+READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y, point1.z-1, 0)).x)
681
+ );
682
+
683
+ const float value0 = READ_RAW_DATA(rawData, sampler, (int4)(point0.x, point0.y, point0.z, 0)).x;
684
+ float diff = native_divide(
685
+ isolevel-value0,
686
+ READ_RAW_DATA(rawData, sampler, (int4)(point1.x, point1.y, point1.z, 0)).x - value0);
687
+
688
+
689
+ // OpenCL on Mac is missing the mix function for some reason
690
+ #ifdef MAC_HACK
691
+ const float3 point0f = (float3)(point0.x, point0.y, point0.z);
692
+ const float3 point1f = (float3)(point1.x, point1.y, point1.z);
693
+ const float3 vertex = (point0f + (point1f-point0f)*diff)*spacing;
694
+ const float3 normal = normalize(forwardDifference0 + diff*(forwardDifference1-forwardDifference0));
695
+ #else
696
+ const float3 vertex = mix((float3)(point0.x, point0.y, point0.z), (float3)(point1.x, point1.y, point1.z), diff)*spacing;
697
+ const float3 normal = normalize(mix(forwardDifference0, forwardDifference1, diff));
698
+ #endif
699
+
700
+
701
+ vstore3(vertex, target*3 + vertexNr, coordinatesVBOBuffer);
702
+ vstore3(normal, target*3 + vertexNr, normalVBOBuffer);
703
+
704
+
705
+ ++vertexNr;
706
+ }
707
+ }
708
+
709
+ __constant uchar nrOfTriangles[256] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 2, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 2, 3, 4, 4, 3, 3, 4, 4, 3, 4, 5, 5, 2, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4, 2, 3, 3, 4, 3, 4, 2, 3, 3, 4, 4, 5, 4, 5, 3, 2, 3, 4, 4, 3, 4, 5, 3, 2, 4, 5, 5, 4, 5, 2, 4, 1, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 3, 2, 3, 3, 4, 3, 4, 4, 5, 3, 2, 4, 3, 4, 3, 5, 2, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 4, 3, 4, 4, 3, 4, 5, 5, 4, 4, 3, 5, 2, 5, 4, 2, 1, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 2, 3, 3, 2, 3, 4, 4, 5, 4, 5, 5, 2, 4, 3, 5, 4, 3, 2, 4, 1, 3, 4, 4, 5, 4, 5, 3, 4, 4, 5, 5, 2, 3, 4, 2, 1, 2, 3, 3, 2, 3, 4, 2, 1, 3, 2, 4, 1, 2, 1, 1, 0};
710
+
711
+ __kernel void classifyCubes(
712
+ __global uchar * histoPyramid,
713
+ __global uchar * cubeIndexes,
714
+ __read_only image3d_t rawData,
715
+ __private float isolevel
716
+ ) {
717
+ int4 pos = {get_global_id(0), get_global_id(1), get_global_id(2), 0};
718
+
719
+ // Find cube class nr
720
+ const uchar first = READ_RAW_DATA(rawData, sampler, pos).x;
721
+ uchar cubeindex =
722
+ ((first > isolevel)) |
723
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[1]).x > isolevel) << 1) |
724
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[3]).x > isolevel) << 2) |
725
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[2]).x > isolevel) << 3) |
726
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[4]).x > isolevel) << 4) |
727
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[5]).x > isolevel) << 5) |
728
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[7]).x > isolevel) << 6) |
729
+ ((READ_RAW_DATA(rawData, sampler2, pos + cubeOffsets[6]).x > isolevel) << 7);
730
+
731
+ // The position can be outside of the original image, if it is, set cubeindex to 0; no triangles
732
+ if(pos.x >= get_image_width(rawData)-1 || pos.y >= get_image_height(rawData)-1 || pos.z >= get_image_depth(rawData)-1)
733
+ cubeindex = 0;
734
+
735
+ // Store number of triangles and index
736
+ uint writePos = EncodeMorton3(pos.x,pos.y,pos.z);
737
+ histoPyramid[writePos] = nrOfTriangles[cubeindex];
738
+ cubeIndexes[pos.x+pos.y*get_global_size(0)+pos.z*get_global_size(0)*get_global_size(1)] = cubeindex;
739
+ }