transformStack.hpp 2.34 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm

#pragma once

#include "transformTypes.hpp"

#include <cmath>
#include <cfloat>

// Defines depending on the environment.
#include "backend/common/vectorOps.hpp"
#include "core/quarticSolver.hpp"

#define INL_FUNCTION_NAME(fnName) fnName
#define INL_TRANSFORM_FN_1D(fnName) inline float fnName
#define INL_CONVERT_3D_2D_FN(fnName) inline float2 fnName
#define INL_CONVERT_2D_3D_FN(fnName) inline float3 fnName
#define INL_PERSPECTIVE_TRANSFORM_FN(fnName) inline float3 fnName
#define INL_ROTATION_TRANSFORM_FN(fnName) inline float3 fnName
#define INL_DISTORTION_TRANSFORM_FN(fnName) inline float2 fnName

#define acosf_vs acosf
#define asinf_vs asinf
#define atan2f_vs atan2f
#define cosf_vs cosf
#define fabsf_vs fabsf
#define invLength2 invLength
#define invLength3 invLength
#define length_vs length
#define powf_vs powf
#define sinf_vs sinf
#define sqrtf_vs sqrtf
#define tanf_vs tanf

#define clampf_vs clampf

#define solveQuartic_vs Core::TransformStack::solveQuartic
#define PI_F_VS CUDART_PI_F

#define dummyParamName /* dummyParamName */

#define convert_float static_cast<float>

#define acos_vs acos
#define cos_vs cos
#define fabs_vs fabs
#define pow_vs pow
#define sqrt_vs sqrt

#define solve_float_t double
#define solve_float_t2 double2
#define solve_float_t3 double3

#define make_solve_float_t2 make_double2
#define make_solve_float_t3 make_double3

namespace VideoStitch {
namespace Core {
namespace TransformStack {

#include "backend/common/core/quarticSolver.gpu"
#include "backend/common/core/transformStack.gpu"

}  // namespace TransformStack
}  // namespace Core
}  // namespace VideoStitch

#undef INL_FUNCTION_NAME
#undef INL_TRANSFORM_FN_1D
#undef INL_CONVERT_3D_2D_FN
#undef INL_CONVERT_2D_3D_FN
#undef INL_PERSPECTIVE_TRANSFORM_FN
#undef INL_ROTATION_TRANSFORM_FN
#undef INL_DISTORTION_TRANSFORM_FN

#undef acosf_vs
#undef asinf_vs
#undef atan2f_vs
#undef cosf_vs
#undef fabsf_vs
#undef invLength2
#undef invLength3
#undef length_vs
#undef powf_vs
#undef sinf_vs
#undef sqrtf_vs
#undef tanf_vs

#undef clampf_vs

#undef solveQuartic_vs
#undef PI_F_VS

#undef dummyParamName

#undef convert_float

#undef acos_vs
#undef cos_vs
#undef fabs_vs
#undef pow_vs
#undef sqrt_vs

#undef solve_float_t
#undef solve_float_t2
#undef solve_float_t3

#undef make_solve_float_t2
#undef make_solve_float_t3