| 198 | |
| 199 | template<typename T> |
| 200 | inline __device__ T get_pixel(unsigned x, unsigned y, const float ori, |
| 201 | const unsigned size, const int dist_x, |
| 202 | const int dist_y, CParam<T> image, |
| 203 | const unsigned patch_size) { |
| 204 | float ori_sin = sin(ori); |
| 205 | float ori_cos = cos(ori); |
| 206 | float patch_scl = (float)size / (float)patch_size; |
| 207 | |
| 208 | // Calculate point coordinates based on orientation and size |
| 209 | x += round(dist_x * patch_scl * ori_cos - dist_y * patch_scl * ori_sin); |
| 210 | y += round(dist_x * patch_scl * ori_sin + dist_y * patch_scl * ori_cos); |
| 211 | |
| 212 | return image.ptr[x * image.dims[0] + y]; |
| 213 | } |
| 214 | |
| 215 | inline __device__ int lookup(const int n, cudaTextureObject_t tex) { |
| 216 | return tex1Dfetch<int>(tex, n); |
no test coverage detected