gdalgrid_priv.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /******************************************************************************
  2. * $Id: gdalgrid_priv.h 29314 2015-06-05 20:21:11Z rouault $
  3. *
  4. * Project: GDAL Gridding API.
  5. * Purpose: Prototypes, and definitions for of GDAL scattered data gridder.
  6. * Author: Even Rouault, <even dot rouault at mines dash paris dot org>
  7. *
  8. ******************************************************************************
  9. * Copyright (c) 2013, Even Rouault <even dot rouault at mines-paris dot org>
  10. *
  11. * Permission is hereby granted, free of charge, to any person obtaining a
  12. * copy of this software and associated documentation files (the "Software"),
  13. * to deal in the Software without restriction, including without limitation
  14. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  15. * and/or sell copies of the Software, and to permit persons to whom the
  16. * Software is furnished to do so, subject to the following conditions:
  17. *
  18. * The above copyright notice and this permission notice shall be included
  19. * in all copies or substantial portions of the Software.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  22. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  23. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  24. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  25. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  26. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  27. * DEALINGS IN THE SOFTWARE.
  28. ****************************************************************************/
  29. #include "cpl_error.h"
  30. #include "cpl_quad_tree.h"
  31. typedef struct
  32. {
  33. const double* padfX;
  34. const double* padfY;
  35. } GDALGridXYArrays;
  36. typedef struct
  37. {
  38. GDALGridXYArrays* psXYArrays;
  39. int i;
  40. } GDALGridPoint;
  41. typedef struct
  42. {
  43. CPLQuadTree* hQuadTree;
  44. double dfInitialSearchRadius;
  45. const float *pafX;
  46. const float *pafY;
  47. const float *pafZ;
  48. } GDALGridExtraParameters;
  49. #ifdef HAVE_SSE_AT_COMPILE_TIME
  50. int CPLHaveRuntimeSSE();
  51. CPLErr
  52. GDALGridInverseDistanceToAPower2NoSmoothingNoSearchSSE(
  53. const void *poOptions,
  54. GUInt32 nPoints,
  55. const double *unused_padfX,
  56. const double *unused_padfY,
  57. const double *unused_padfZ,
  58. double dfXPoint, double dfYPoint,
  59. double *pdfValue,
  60. void* hExtraParamsIn );
  61. #endif
  62. #ifdef HAVE_AVX_AT_COMPILE_TIME
  63. int CPLHaveRuntimeAVX();
  64. CPLErr GDALGridInverseDistanceToAPower2NoSmoothingNoSearchAVX(
  65. const void *poOptions,
  66. GUInt32 nPoints,
  67. const double *unused_padfX,
  68. const double *unused_padfY,
  69. const double *unused_padfZ,
  70. double dfXPoint, double dfYPoint,
  71. double *pdfValue,
  72. void* hExtraParamsIn );
  73. #endif
  74. #if defined(__GNUC__)
  75. #if defined(__x86_64)
  76. #define GCC_CPUID(level, a, b, c, d) \
  77. __asm__ ("xchgq %%rbx, %q1\n" \
  78. "cpuid\n" \
  79. "xchgq %%rbx, %q1" \
  80. : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
  81. : "0" (level))
  82. #else
  83. #define GCC_CPUID(level, a, b, c, d) \
  84. __asm__ ("xchgl %%ebx, %1\n" \
  85. "cpuid\n" \
  86. "xchgl %%ebx, %1" \
  87. : "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
  88. : "0" (level))
  89. #endif
  90. #endif