MCPcopy Create free account
hub / github.com/NVIDIA/cuda-samples / Tex2Di

Function Tex2Di

cpp/5_Domain_Specific/HSOpticalFlow/flowGold.cpp:103–118  ·  view source on GitHub ↗

////////////////////////////////////////////////////////////////////////// \brief host texture fetch read specific texel value out of range coords are mirrored \param[in] t texture raw data \param[in] w texture width \param[in] h texture height \param[in] s texture stride \param[in] x x coord of the point to fetch value at \param[in] y y coord of the point to fetch value at \ret

Source from the content-addressed store, hash-verified

101/// \return fetched value
102///////////////////////////////////////////////////////////////////////////////
103inline float Tex2Di(const float *src, int w, int h, int s, int x, int y)
104{
105 if (x < 0)
106 x = abs(x + 1);
107
108 if (y < 0)
109 y = abs(y + 1);
110
111 if (x >= w)
112 x = w * 2 - x - 1;
113
114 if (y >= h)
115 y = h * 2 - y - 1;
116
117 return src[x + y * s];
118}
119
120///////////////////////////////////////////////////////////////////////////////
121/// \brief resize image

Callers 2

DownscaleFunction · 0.85
ComputeDerivativesFunction · 0.85

Calls 1

absFunction · 0.50

Tested by

no test coverage detected